[stringtemplate-interest] :html(), :url(), applying Java function from template

Andrew Goodnough Andrew.Goodnough at wicourts.gov
Wed Jun 7 05:39:40 PDT 2006


1) Not possible in pure ST (not desirable, either).
2) Already possible.  If you change the colon to a dot you can call a
method on the JavaBean.

link(href) ::= "<a href='$href.url()$'>$href.html()</a>"

In your example you set the "href" parameter to your Href bean, which
has methods getUrl() and getHtml() which return an encoded string.

Andy

>>> On Wed, Jun 7, 2006 at  2:35 am, in message
<web-680123401 at umail.ru>, "Anton
Tagunov" <anton.tagunov at umail.ru> wrote: 
> Hello gentlemen, makes sense?
> 
>     link(href) ::= "<a href='$href:url()$'>$href:html()</a>"
> 
> 1) is it possible to write html() and url() encoding functions in
pure ST at 
> all?
> 2) would be grand to write html() and url() in Java and hook into
ST!
> 
>      C'on, we've already got a functional language.
>      Now we need to hook Java functions into it.
>      Granted, side effects would be forbidden.
> 
> Anton Tagunov
> 
> P.S. Example adapted from http://etl.i- want- a-
pony.com/doc/etl.html
> 
> 
> 
> _______________________________________________
> stringtemplate- interest mailing list
> stringtemplate- interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate- interest



More information about the stringtemplate-interest mailing list