OK, Helpinator is a multi-format single source help authoring tool, e.g. you can create help files and documentation in different formats from the same source. But what if you need different versions of content? Say, your app has two edition: Pro and Lite with different sets of features and you need to create CHM help files for both editions. What to do? Create different help projects for each edition? NO! Use conditional output!
Conditional output is based on variables. Variable values control conditional statements, that in their turn alter output at compile time. Helpinator has special type of variables that allow to switch their values quickly. Values of these variables depend on which values preset is selected at compile time. Take a look at the “Variables” tab of project options. At the bottom of it there’s “Preset” drop-down list and commands to add, rename and delete presets. Let’s add two presets: “PRO” and “LITE”.
Now we can add control variable that we will use in conditional statements. Let’s call it “EDITION”.
Set it’s value to “PRO” for PRO preset and “LITE” for LITE preset.
Now when “PRO” preset is selected this variable has PRO value in it and LITE when “LITE” preset is selected.
There are two ways you can control output:
- Via IF directives in the topic content
- Via topic inclusion condition
First let’s see how to use IF directive. Say, our help project has “Features” topic with a list of features in it. Remember, our PRO and LITE editions have different sets of features. You can use a directive like this to make topic “Features” contain only features of LITE or PRO editions:
But that’s only one problem. Our help project also contains separate topics for each of the features and we do not want to include topics with features of PRO edition into the help file of LITE edition. This is where topic inclusion condition comes in help. Take a look at the bottom of the topic editor, there’s “Skip topic” tab. It contains “Skip when condition is FALSE” field, it allows you to set condition for topic inclusion. In our case we’ll create a condition EDITION=’PRO’ for the topics that cover features of PRO edition, so they will be included in PRO edition help file and skipped from LITE edition help file:
Hope this little tutorial will help you to get familiar with conditional compilation. Also there’s a sample project with the same name that you can access via “Samples” section of the welcome screen. Click “More samples” and select “Conditional output” from the list.