[stringtemplate-interest] Newbie question
Terence Parr
parrt at cs.usfca.edu
Mon Oct 26 10:40:06 PDT 2009
On Oct 26, 2009, at 10:33 AM, Brain, Jim wrote:
> I’m a recent ST user, but I’ve successfully integrated ST into my
> project (a Template-based XML schema code generator). I have,
> though, noticed some things that are not intuitive, even after
> reading the documentation.
>
> Autoindent?
>
> StringTemplate st = new StringTemplate(" $reader:{$it$
> \n\n}$ $writer:{$it$\n\n}$ stuff");
perhaps you want to use wrap?
> I know I’m falling victim to this: “Indentation can only occur at
> the start of a line so indentation is only tracked in front of
> attribute expressions following a newline.". However, adding a
> newline in front of the second indentation adds an unwanted newline
> in the resulting code, and it seems problematic to go to a [$reader,
> $writer] construct to avoid the issue. Is there a reason why indent
> cannot be tracked from the end of the last function?
Yep, since it can't compute statically if a \n occurs inside.
Ter
More information about the stringtemplate-interest
mailing list