[stringtemplate-interest] args on map templates WAS template expressiveness
Terence Parr
parrt at cs.usfca.edu
Fri May 11 15:26:05 PDT 2007
> As it is, I am required to have two *completely* separate templates
> that are identical, except they output different colored TR tags...
> $stuff:row1(), row2()$
>
> If ST could curry, then it would work...
> $stuff:row(color="red"), row(color="blue")$
I added a bug report but I noticed incidentally just now in a site I
have:
$(highlights:descriptor/testimonial()):outlinedbox(title="Highlights")$
which applies a template to the highlight descriptors, takes the
value, and puts box around whole thing using an arg of a title!
Seems to me you can do this already.
> A potentially better solution...
> $stuff:{
> <tr $if(i % 2)$style="color:red"$endif$><td>$it.name$</td></tr>
> }$
Not as clear I think. You're saying how not what you mean.
Ter
More information about the stringtemplate-interest
mailing list