This macro iterates over the lines of the multiline block of text using the special %CurrentLine% local variable.
.foreach_line (input [,head [,tail]]) output .next [(separator)]
The following parameters are available:
Parameter |
Description |
---|---|
input |
Specifies the text over which to iterate. Type: Simple template |
head |
[optional] Specifies text to be generated before the output, unless there is no output. Type: Text |
tail |
[optional] Specifies text to be generated after the output, unless there is no output. Type: Text |
output |
Specifies the text to output for each line in the input. Type: Complex template |
separator |
[optional] Specifies text to be generated between each line of output. Type: Text |
Example |
---|
.foreach_line(%Comment%,"/**\n","\n*/") * %CurrentLine% .next("\n")Result: /** * This is my comment. * It is a Java style documentation comment. * It spans several lines. */ |