Chapter: Conditional Compilation >
Conditional Compilation: Overview
HelpSmith allows you to compile different variants of the same help system by using the possibilities of
conditional compilation. This help topic describes the key aspects that you need to know to use
conditional compilation in your own help projects.
How Conditional Compilation Works
Conditional c ompilation is based on build tags which are defined for your help project and also on
conditions which are defined for individual entities (a topic, a conditional text block, etc.). Build tags are
simple objects with a name and description, that you c an add to your help project. Conditions, in turn, are
also based on build tags, but conditions use a combination of build tags and logical operators (OR, AND, OR
NOT, AND NOT) to implement the desired logic by which HelpSmith will determine if the entity should be
included or exc luded to/from the compiled help system. Finally, when you compile your help project, you
can select build tags that should be applied to the given compilation. Thus, you can easily generate a
specific version of the help system according to your own needs.
About Build Tags
Any help project already has a number of build tags that correspond to the supported help formats (HTML
Help, Web Help, Printed Manual). These are system system build tags that cannot be deleted or renamed.
However, you can also add custom build tags for which you can set any name and description. For your
convenience a new help project already includes custom build tags (Custom1, Custom2), but you can
delete or rename them like any other c ustom build tags.
You can visit this topic for more details on editing build tags of your help project.
Defining Build Options (Conditions) for an Entity
An entity that can be included or excluded to/from the output help system allows you to define build
options for it. Build options are a set of conditions that can use build tags and logical operators: AND, OR,
AND NOT, OR NOT. Thus, build options defined for an entity can be evaluated either with a positive (True)
or negative (False) result, which determines whether to include or exclude this entity to/from the
compilation. The Build Options dialog-box allows you to define simple conditions (IF, IF NOT) which
implement only OR logic, but also it allows you to add extra conditions that can implement any other logic.
When to Use Conditional Compilation
There are different situations when you may need to use c onditional compilation in your help project. Here
are some examples:
•
You develop a help system for different editions of the same product (e.g. free, standard, and
professional edition) and would like to include or exclude some content to/from the help file written
for a certain product version.
•
You need to create custom builds of the help system for a number of your marketing partners and
would like to replace company names or URLs according with their requirements.
•
You may be working on new content that should not be released until the features it describes are
available in the product.
•
You may want to include or exclude some blocks of text to/from a specific output help format or
to/from a specific output help format in a custom build, etc.
Thus, the conditional compilation functionality allows you to have a single source help project and easily
get different versions of the help system, which eliminates the need to edit separate copies of the same
help project.
See also
•
Editing Build Tags
•
Defining Conditions
•
Including/Excluding Help Topics
•
Conditional Text
•
Compiling Help Project with Build Tags
•
Processing Dead Links
Copyright © 2007-2013 HelpSmith.com
76