Bob MacLeod wrote: ↑Fri Jun 19, 2020 11:51 am- Is it possible to use an IF/THEN (not sure what that trigger is called) where the entire line would be visible or hidden depending on whether the status is complete or not? By doing that, only non-complete topics would contain the text "Topic Status:" and completed topics would show nothing?
If you are publishing the drafts to an HTML format (WebHelp, eWriter, CHM) there's a hack to do this:
- Don't put "Topic status:" in front of <%TOPICSTATUS%>
- Instead, create a new style (i.e. with a unique name) and apply that directly to <%TOPICSTATUS%>
- Use CSS to define that style (specifically the f_stylename variant published by H+M) as having "Topic status: " (or similar) as its ::before content
This works because if the variable is empty it doesn't get output, so the style isn't applied. Here's a snippet that uses this approach:
myStatusStyle is defined as Normal+red in H+M's snippet repository,
f_myStatusStyle is generated by H+M when publishing to HTML, so that's what we extend using CSS:
Code: Select all
<topic template="Default" lasteditedby="SimonDismore">
<title translate="true">myStatus</title>
<body>
<header>
<para styleclass="Heading1"><text styleclass="Heading1" translate="true">myStatus</text></para>
</header>
<para styleclass="Normal"><html-code width="100" height="16" inline="true"><![CDATA[<style>.f_myStatusStyle::before
{content: "Note: this topic is ";}
</style>
]]></html-code><var styleclass="myStatusStyle"><%TOPICSTATUS%></var></para>
</body>
</topic>
When the topic status is 'Complete', nothing is output, because H+M doesn't style the empty <%TOPICSTATUS%> variable. If there's another status (e.g. 'Under Construction') the variable is rendered by prepending the ::before content to the variable value, and formatting the result as it is styled in H+M (e.g. "
Note: this topic is Under Construction").
For more about ::before etc, see
this CSS Tricks article.