Chapter 9 Generation Reference Guide (GTL)


GTL Macros

Macros can be used to express template logic, and to loop on object collections. Each macro keyword must be preceded by a . (dot) character and has to be the first non blank character of a line. Make sure you also respect the macro syntax in terms of line breaks.

You define a macro inside a template, or a command entry.

There are three types of macros:

'.'<macro-name> ['(' <parameters> ')' ]
<macro-block-input>
'.'end<macro-name > [ '(' <tail> ')' ]

<tail> is an optional string constant appended to the generated text, if there is one.

'.'foreach_<macro-name> ['(' <parameters> [',' <head> [',' <tail>]] ')' ]
<complex-template>
'.'next [ '(' <separator> ')' ]

<head> and <tail> are both optional string constants. <head> is generated before, and <tail> is appended to the generated text, if there is one.

A <separator> may optionally be specified as an argument to the .next keyword, it is placed between non-empty evaluations of <complex-template>.

Note   Macro parameters delimiters
Macro parameters may be delimited by double quotes. The delimiters are required whenever the parameter value includes commas, braces, leading or trailing blanks. The escape sequence for double quotes inside a parameter value is \".

You can use the following macros:

 


Copyright (C) 2007. Sybase Inc. All rights reserved.