Attributes
AsciiDoc attributes enable text substitution and conditional compilation of content. They are particularly useful for generating multiple flavors of a documentation site tailored to different audiences or configurations.
Conditional attributes
Attributes meant for controlling conditional compilation are simply either defined or not, and they take this form in the manifest file:
ATTRIBUTE=trumpf
Such a condition attribute can be used to include some content only if it set, using the ifdef construct in AsciiDoc. For example, in the content below, the second paragraph is included only if the trumpf attribute is defined in the manifest.txt file.
It is possible to program laser machines, press-brakes and panel-benders, and
generate NC code directly.
#ifdef::trumpf[]
Full integration with the Oseon and Fab systems is also available.
#endif::[]
These conditional attributes can also be used in the contents.txt files to include entire topics (or even sub-folders) based on whether an attribute is defined or not. For example, suppose we have a contents.txt file like this:
Introduction
CADSketch #if(!trumpf)
UIConventions
[Cut]
[Bend] #if(trumpf)
[Fold]
[Reports]
Then, the CADSketch page is included only if the trumpf attribute is NOT defined, and the entire [Bend] subfolder of content is included only if the trumpf attribute IS defined.
Substitution attributes
These attributes are used to replace a particular tag with appropriate expansion text. These attributes take the following form in the manifest file:
ATTRIBUTE=appName:Flux
For example, suppose a product has different names by which it is marketed in different regions, one could avoid using the actual product name in the documentation, and use instead the attribute tag in curly braces. Assuming an attribute definition as listed above, one could write:
Welcome to \{appName\}!
\{appName\} is an integrated sheet-metal solution.