[stringtemplate-interest] maps, length, wrapping

Kay Roepke kroepke at dolphin-services.de
Sat Jan 28 18:40:45 PST 2006


On 29. Jan 2006, at 0:07 Uhr, Terence Parr wrote:

> How can we insert a newline when length is greater than 80?   
> Technically
>
> <if(length(names)>80)><\n><endif>
>
> doesn't break the rules but then I must do flow analysis to prevent  
> you from testing attribute values.

Just had a thought...
We most certainly want this to break up long lines, don't we?
Then it wouldn't make much sense to specify what to do when the list  
length is larger than, say, 80,
but instead we are interested in the character length of the  
resulting string.
Could we possibly use some option like separator to do that?
E.g.:

<names:{<it>}; separator=",", maxLineLength="80", lineSeparator="\\\n">

with the appropriate warning when the first element is already longer  
than maxCharLength?

Then we wouldn't even need any comparisons (which probably would  
spark discussion about being able
to test for attribute values later down the road...)?

Is this complete crap, or does it sound sensible?

-k


More information about the stringtemplate-interest mailing list