Chapter 9 Generation Reference Guide (GTL)
The foreach_line macro is a simple macro that iterates on the lines of the input template specified as the first argument to the macro. The template specified inside the block is translated for each line of the input. This macro creates a new scope with the local variable CurrentLine. This one is defined inside the block to be the i-th line of the input template at iteration i.
.foreach_line '(' <input> [',' <head> [',' <tail>]] ')' <complex-template> .next ['(( <separator> ')']
Parameter | Type | Description |
---|---|---|
<input> | Simple template | Input text over which iteration is performed |
<head> (optional) | Text | Generated before output, if there is one |
<tail> (optional) | Text | Appended to the output, if there is one |
<separator> (optional) | Text | Generated between non empty evaluations of <complex-template> |
The output is the concatenated evaluations of <complex-template> for each line of the translated template <input>.
Example:
.foreach_line(%Comment%) // %CurrentLine% .next(\n)
Copyright (C) 2005. Sybase Inc. All rights reserved. |