Extra features for IF/IFNOT in HTML templates

Nothing is perfect! This is where you can post your ideas and wishes for functions you'd like to see in Help & Manual. Current version only please (H&M7).

Moderators: Alexander Halser, Tim Green

Post Reply
Simon Dismore
Posts: 454
Joined: Thu Nov 16, 2006 1:29 pm
Location: London, UK

Extra features for IF/IFNOT in HTML templates

Unread post by Simon Dismore »

Background is that Webhelp templates currently support IF/IFNOT expressions for:
  • Project information
  • IF_GAACCOUNT: True means the configuration includes a Google Analytics account.
    Publishing information
  • Build IDs: True means the ID has been selected in the current publishing task. IDs may be author-defined or predefined (IF_EBOOK, etc).
  • Output settings: IF_INDEX_PAGE, IF_SEARCH_PAGE, IF_XHTML, IF_FRAMES.
    TOC-relative information
  • Tests existence of topics before or after the current topic, e.g. IF_NEXT_PAGE.
  • Whether <%TOPIC_BREADCRUMBS%> is empty.
    Topic information
  • Tests whether the current topic has a header, toggles, featured image.

I propose you expose two extra types of information for use in Webhelp template expressions. To avoid potential problems overlapping with existing names, you could add a prefix or suffix, e.g. "_TOPIC" as below.

(A) Topic text variables
Test the value of a text variable in the context of the current topic, where True means the variable contains a value, and False means it is empty. For example, if I have a variable <%UNLOCKED%> whose default value is empty, then IF_UNLOCKED_TOPIC is False by default, but True for each topic where the default value has been overridden.

(B) TOC entry build ID
Test whether this topic's entry in the current TOC has been assigned a particular build ID, where True means this topic's TOC entry has the given ID. This is not the same as testing whether the current publishing task includes the build ID. For example, if I have a build ID called "Premium", the existing IF_/IFNOT_PREMIUM expressions test whether the Premium checkbox is selected on the publishing task. I'm suggesting an extra pair of expressions (e.g.) IF/IFNOT_PREMIUM_TOPIC to test whether this topic has this build ID in the TOC. H&M predefined build IDs should be evaluated the same way, e.g. IF_HTML_TOPIC would test whether the current topic has either the HTML or the 'ALL' build ID set.

To be useful, these extra features must be compatible with existing conditional syntax, so compound expressions like <IF_PREMIUM|UNLOCKED_TOPIC>...</IF_PREMIUM|UNLOCKED_TOPIC> and <IFNOT_PREMIUM><IF_PREMIUM_TOPIC>...</IF_PREMIUM_TOPIC></IFNOT_PREMIUM> are valid.

A typical use case and benefits can be seen at Public vs privileged webhelp build.
Thanks for considering this.
paul zandbergen
Posts: 4
Joined: Wed Mar 19, 2014 12:18 pm
Location: Culemborg, Netherlands

Re: Extra features for IF/IFNOT in HTML templates

Unread post by paul zandbergen »

I like the testing of text variables.

I would like to have this for using in automated publishing. Some check I can do from the command line to make sure every (user) variable is filled before I generate output.
Post Reply