#### 42.2.6 Assigning a macro or variable to a configuration variable

When you assign a value to a configuration variable, and the value includes the name of a macro or a macro variable, whether or not that name should be enclosed in quotes depends on the context:

- In a *Config PI marker, a value is always assigned literally, as is, so you can either include or omit quotes around the name of a macro or variable.
- In a macro, a value is assigned literally only if it is enclosed in quotes. If the value includes a macro name, the entire value should be quoted. Such a value may not contain a quote.

For example:

HTMConfig: [ParaStyleCodeAfter]=<$macafter>

HTML Macro: <$$[ParaStyleCodeAfter]="<$macafter>">

Angle brackets get processed in a macro

When you assign a value to a configuration variable in a macro, and the value contains any < or > characters (angle brackets), absent enclosing quotes DITA2Go processes each angle bracket as the start or end of a macro, instead of assigning the entire value as a string. That is, DITA2Go would try to figure out if maybe the string is something else first. When the value includes a > character that it is not in quotes, the macro ends prematurely. In this example:

<$$[ParaStyleCodeAfter]=<hr>>

DITA2Go would assign only <hr to the configuration variable, because the > after <hr would be taken as the end of the macro; and then DITA2Go would drop the real ending > into the current text.

Unquoted variables are evaluated in a macro

When you assign a macro variable to a configuration variable in a macro:

- Enclose the macro variable name in quotes if you want the macro variable to be evaluated later, at run time.
- Do not enclose the macro variable name in quotes if you want the macro variable to be evaluated immediately, so the configuration setting gets the current value of the macro variable instead of just its name.

Previous Topic: 42.2.5 Adding a new configuration setting on the fly

Next Topic: 42.2.7 Understanding fixed-key vs. variable-key settings

Parent Topic: 42.2 Overriding settings with PI markers or macros

Sibling Topics:

42.2.1 Determining the extent of a configuration override

42.2.2 Overriding settings with configuration PI markers

42.2.3 Overriding settings with macros

42.2.4 Assigning values to configuration variables

42.2.5 Adding a new configuration setting on the fly

42.2.7 Understanding fixed-key vs. variable-key settings

42.2.8 Overriding fixed-key configuration settings

42.2.9 Overriding variable-key configuration settings

42.2.10 Assigning HTML table and graphic groups with overrides

Table of Contents • Index