[stringtemplate-interest] Grokking StringTemplate

Nate misc at n4te.com
Tue Feb 13 12:57:26 PST 2007


Don't use $$ when inside an if, because you are already inside $$. Eg...
$if(it.countIsOne)$
...and NOT...
$if($it.countIsOne$)$

Also, templates can have multiple parameters. Eg...
variable(type,name) ::= <<
   <b>$type$</b> $name$ = $typeInitMap.(type)$;$\n$
 >>
Take from this page...
http://www.antlr.org/wiki/display/ST/simple_group_example

-Nate


Ian Rae wrote:
> After trying ST in Java for a couple I've days, I've written an 
> article 
> http://silentsoftware.blogspot.com/2007/02/grokking-stringtemplate.html 
> <http://silentsoftware.blogspot.com/2007/02/grokking-stringtemplate.html>
>
> I'ld appreciate any comments.  I have the feeling there is a simpler 
> way to do what I want, but can't find it.
>
> Cheers,
> --Ian Rae
>


More information about the stringtemplate-interest mailing list