Literal Text

Return to Introduction  Previous page  Next page

All text within a given template that is not part of a macro or a variable definition/reference, is considered literal text. With the exception of blank lines, which are ignored, literal text is directly substituted from the template into the generated code.

Consider the following excerpt from the java Class Declaration template:

%PI=" "%

%CONVERT_SCOPE(classScope)%

 

%classStereotype=="static" ? "static" : ""%

%classStereotype=="final" ? "final" : ""%

%classStereotype=="static final" ? "static final" : ""%

%classAbstract=="T" ? "abstract" : ""%

%PI=""%

class %className%$bases

 

On the final line, the word class, including the subsequent space, would be treated as literal text and thus reproduced in the output. The blank line following the CONVERT_SCOPE macro, however, would have no effect on the output.

The %, $ and " characters have special meaning in the template syntax and cannot always be used as literal text. If these characters must be generated from within the templates, they can be safely reproduced using the following direct substitution macros:

Macro

Description

%dl%

Produces a literal $ character.

%pc%

Produces a literal % character.

%qt%

Produces a literal " character.