[stringtemplate-interest] leading/trailing whitespace trimmed

Terence Parr parrt at cs.usfca.edu
Fri Apr 18 15:16:20 PDT 2008


On Apr 17, 2008, at 8:38 PM, Zenaan Harkness wrote:
> The reason I don't do it that way (yes it would work for multi-line
> getter), is that I wanted to have the default be a single-line getter,
> as in, the template producing something like:
>
>   public String getInfo () {return _info;}

ah. ok.

> and only if there's a custom getter do I go to multi line, and then  
> only
> if the custom getter _needs_ to go multi line. This is why I went to
> such lengths of experimentation :)

a custom output writer might be able to do this as well...

> So, they way I have it, the default getter and custom getters are one
> line, and multi-line custom getters are multi line.

I'll bet that if I had an array of statements, I could figure out a  
way to get ST to do this without worrying about all the whitespace.   
For example, <if(rest(statements))> probably says that there are more  
than one statement. You can switch on this then.

> I am totally stoked with what I am achieving with ST. Not only is it

great!

> possible to do what I want, but I can jig the templates to produce
> some flexibility in output too (single vs multi line getters for  
> example
> :)
>
> Thank you ____________this_____________ much for ST.

My pleasure...yeah, I really love this tool. :)

> Now, if we can just get built in template existence checking ... :)
> (see earlier email, ala:
> <ifexists(TEMPLATE_NAME_TO_CHECK)><(TEMPLATE_NAME_WILL_RUN)()><endif>
>
> Seems like a simple tamplate_name->template lookup table...

The methods exist of course, but you cannot pass a parameter to them  
from ST.  Hmm....

Ter


More information about the stringtemplate-interest mailing list