Conditional text include options are used to include or exclude specific passages of text and other items within a topic on the basis of one or more conditions.
See Conditional text in tables to learn how to use conditional text in tables, where they have additional capabilities for tagging rows and columns. See Command Line Options for details on how to use these options from the command line and in batch files.
This is the fastest and easiest way because it automatically inserts the condition tags at the beginning and end of the text and other content you want to tag. If you want to use an ELSE tag as well you must still insert it manually, however (see further below).
1.Select the text or items you want to include or exclude in the editor.
2.Select
3.In the dialog displayed select:
IF to include the selection if the condition is True when you publish (e.g. include text in CHM output)
IFNOT to include the selection if the condition is False when you publish (e.g. include text in all outputs except CHM)
4.Select all the conditions you want to apply by checking the boxes next to their names. You can apply multiple conditions in a single conditional text tag.
5.Click on . The beginning and end of the conditional text block are marked by orange tags in your text. |
When you use this method you must insert the IF, ENDIF and ELSE (if used) tags separately, selecting the Conditional Text tool once for each individual tag.
1.Click in the position where you want the text condition to begin.
2.Select
3.In the dialog displayed select:
IF to include the selection if the condition is True when you publish (e.g. include text in CHM output)
IFNOT to include the selection if the condition is False when you publish (e.g. include text in all outputs except CHM)
4.Select all the conditions you want to apply by checking the boxes next to their names. You can apply multiple conditions in a single conditional text tag.
5.Click on to insert the tag.
6.Click in the position where you want the text condition to end.
7.Select the Conditional Text tool again and insert the ENDIF condition. |
You can nest conditional text blocks but do this with caution, it is easy to get confused with complex conditions and to produce unexpected results.
Nested tags are evaluated starting with the outer tags. Evaluation stops as soon as a condition evaluates as false, effectively creating AND logic. For example:
IF_CHM IF_DEMOBUILD content content content content ENDIF ENDIF
In the above example the content will only be included if the output format is CHM and DEMOBUILD is selected in the Publish settings.
|
The ELSE condition can be used to provide an alternative text to be displayed if your main condition is not fulfilled. It is inserted as a single tag between a pair of IF/ENDIF or IFNOT/ENDIF tags. The ELSE condition is not associated with any include options. It simply provides an alternative block of content to be included if the previous conditions do are not evaluate as true when you publish.
•Just click in the position in the text where you want to insert the ELSE condition, select , and then select ELSE.
If the main condition evaluates True when you publish then everything between the IF tag and the ELSE tag is output. If the main condition evaluates False when you publish then everything between the ELSE tag and the ENDIF tag is exported.
Example:
The following condition will output TEXT 1 if the output format is HTML Help (CHM), otherwise it will output TEXT 2:
IF_CHM Text 1 ELSE Text 2 ENDIF
|
Double-click on the orange text condition tag in your text to display the Text Condition dialog, or right-click on the tag and select Edit.
|
1.Select Publish in the tab or the File menu.
2.Select your output format, then activate the include options as required in the Publish settings.
All content tagged with conditional text include options matching the Include Options selected here will be included or excluded in your output, depending on whether you used IF or IFNOT.
3.Check the other settings and then click on Publish Now to publish. |
See also:
Conditions and Customized Output
Defining include options
Topic include options
Command Line Options