velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmed Mohombe <>
Subject Re: Best practice for escaping?
Date Thu, 27 Oct 2005 22:50:22 GMT
> personally, my recommendation would be to ditch the escaping rules for
> variables and go with the following:
> #set( $D = '$' )
> ${D}myVar
> or you can add the new EscapeTool (in VelocityTools 1.2-rc1) to your
> context and do:
> ${esc.d}myVar
> escaping is really a pain if you aren't sure whether a variable will
> be there or not.  i haven't done it to generate another velocity
> template, but the thought is unpleasant. :)
Thank you very much for the fast reply.

Unfortunately if I 'obfuscate' the templates, the possibility for an error would
be even bigger.

It's seems to me much simpler at the moment to generate the velocity templates
with another template engine that has a totally different syntax, so that it won't
interfere with the velocity variables, defined or not or have the same name
in the source template with the destination template. Not to mention the escaped directive
that behave again different from at variable pespective.

I wonder why there isn't a more elegant solution for such situations :(.

Maybe it has nothing to do with the syntax, but the Velocity syntax is very easy and clean
in a 
direct form.
IMHO the escaped syntax should be as easy, and comprehensible, so that one understands from
a simple 
sight what's up there.
Unfortunately I found no tool that handles the escaped template gracefully :(, so that at
least with 
syntax highlight to make it evident.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message