Conditional text include options

Navigation:  More Advanced Procedures > Conditions and Customized Output >

Conditional text include options

Previous pageReturn to chapter overviewNext page

Show/Hide Hidden Text

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 Command Line Options for details on how to use these options from the command line and in batch files.

flag_green        Key Information

A condition that starts before a table must end after the table. You cannot start a condition before a table and end it inside the table. Inside tables conditions must start and end inside the same cell. Conditional text cannot span table cells!

Click to expand/collapseMethod 1: Select text first

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 Write > Insert Object > BTN_Insert_Condition

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 OK. The beginning and end of the conditional text block are marked by orange tags in your text.

Click to expand/collapseMethod 2: Setting the IF and ENDIF tags manually

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 Write > Insert Object > BTN_Insert_Condition

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 OK  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.

Click to expand/collapseNesting include tags

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.

Click to expand/collapseUsing the ELSE condition

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 Write > Insert Object > BTN_Insert_Condition, 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 output.

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

Click to expand/collapseHow to edit text conditions

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.

Click to expand/collapseHow to apply include options when you publish

1.Select Publish in the Project tab or the File menu.

2.Select your output format, then activate the include options as required in the Publish settings.

dlg_publishinclude

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 Publish Now to publish.

See also:

Conditions and Customized Output

Defining include options

Topic include options

Command Line Options