in reply to Templating suggestions for code generation
Your example would look something like:
[%- items = ['one', 'two', 'three'] -%] # Output an array data structure in perl. @array = ( [%- FOREACH item IN items -%] [%- IF loop.last -%] '[%- item -%]' [%- ELSE -%] '[%- item -%]', [%- END -%] [%- END -%]);
You can run this from the command line after you install Template using the tpage command. The extra '-' gets rid of whitespace from inside the template directives. If you want the code to look nice, you'll have to play with the spacing a bit.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Templating suggestions for code generation
by bart (Canon) on Feb 17, 2005 at 14:17 UTC | |
by merlyn (Sage) on Feb 17, 2005 at 14:35 UTC | |
by cbrandtbuffalo (Deacon) on Feb 17, 2005 at 16:24 UTC | |
by merlyn (Sage) on Feb 17, 2005 at 16:36 UTC |