[stringtemplate-interest] Newlines and templates applied to multivalued attributes.

Stenglein, David David.Stenglein at deshaw.com
Thu Jul 3 13:48:16 PDT 2008


All,

I'm having a bit of trouble with newlines (seperators) when I am doing a
conditional test 
inside of a template being applied to a multi-valued attribute. I don't
want a
newline created if the called template has no output.


Outertemplate ::= <<

<listofthings:listitem();separator="\n">

>>


listitem(potentialitem) ::= <<
<if(potentialitem.attribute)>
Print something.
<endif>
>>

If I have a list of 5 items and the last two have attribute=True, then I
get three blank lines and two properly separated list items.

If I put a trailing newline in listitem(), then things are separated, of
course, but there is a trailing newline.

Any suggestions? I'd like to avoid having an intermediate template if
it's not necessary.

Thanks,
Dave


More information about the stringtemplate-interest mailing list