Dynamic Expansion
Dynamic expansion is a feature that allows values to be dynamically expanded at run time. For historical reasons, these string expansions are called "xlats".
Dynamic expansion is performed via the following syntax:
%{…}
Where the %{
signals the start of a dynamic expansion, and }
signals the end of the dynamic expansion. Dynamic expansions are most
commonly used in double-quoted strings,
and expressions / conditions.
The contents of an expansion can be many things, such as attribute references, function calls, etc. The table below gives more examples of expansions.
Keyword | Description |
---|---|
Expand the value of a named attribute. |
|
Single character expansions. |
|
Function call syntax |
|
Conditionally expand a string. |
|
Functions as string length, tolower, etc… |
Expansions are used inside of double-quoted strings and for the back-tick quoted strings
Character Escaping
Some characters need to be escaped within a dynamically expanded
string %{…}
. The %
character is used for variable expansion, so a
literal %
character can be created by using %%
.
Other than within a dynamically expanded string, very little character
escaping is needed. The rules of the enclosing string context
determine whether or not a space or "
character needs to be escaped.
See the ref:type/string/double.adoc[double-quoted strings] and
back-tick quoted strings pages for more
information.
&Reply-Message := "%{User-Name} with a literal %%"