One of the advantages of DITA2Go user variables is that they provide a way to produce additional output that is separate from the main document output stream, and that includes metadata. This allows you to do things such as construct title pages and generate lists. To produce such output, you deploy user variables in a template macro. A template macro is a macro whose name is assigned to an external file name. A macro template associates a template macro with a file name.
To assign a template macro to a file:
[MacroTemplates] ; filename.ext for template output doc = template macro name filename.ext = macroname ; or: filename.ext = path/to/macro/file
The name of the file to which you assign the template macro must include an extension, and may include a path. The default location for the file is the output directory.
The template macro name can refer to any of the following:
This example assigns a template macro named $BookTitlePageTemplate to an output file named booktitlepage.htm located in the output directory:
[MacroTemplates] booktitlepage.htm = BookTitlePageTemplate
Variable maptitle is assigned to the map title for the document:
[VariableMaps] title/map/1 = maptitle
The content of variable author (element author is automatically a variable; see property Var in Table 11-1) is replaced with a new value:
[MacroVariables] author = Omni Systems
The template macro is defined in the configuration file:
[BookTitlePageTemplate] <html><head> <title><$$maptitle></title> </head><body> <h1><$$maptitle></h1> <p class="author">By <$$author></p> </body></html>
When <$BookTitlePageTemplate> is invoked, DITA2Go writes the following to file booktitlepage.htm in the output directory:
<html><head> <title>DITA Test Suite</title> </head><body> <h1>DITA Test Suite</h1> <p class="author">By Omni Systems</p> </body></html>