velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nbu...@gmail.com>
Subject Re: Is it possible to have velocity ignore certain characters?
Date Sat, 09 Jun 2012 14:26:38 GMT
No, the parser is JavaCC-generated and not dynamically modifiable.  If
you are using a lot of syntax that is like VTL, but is not actually
VTL (like your example), either use literals to avoid the syntax
conflicts

http://velocity.apache.org/engine/releases/velocity-1.7/user-guide.html#stringliterals

or consider a different template engine that has a non-conflicting
syntax, like Freemarker or StringTemplate.  Any time you choose a
template engine, syntax conflicts should be one of your top concerns.

On Thu, Jun 7, 2012 at 11:21 PM, tdoughty
<timothy.evan.doughty@gmail.com> wrote:
>
> I'm just starting with Velocity at my internship, but I couldn't find the
> answer to this. Is it possible to have Velocity ignore certain characters?
> Velocity is giving an error when it encounters a '[' in the html file. I
> will post the exact error tomorrow when I have access to my work computer.
> The html file looks like:
>
>
> ...
>
> ...${variable[encoding=html]}...
>
> ...
>
>
> It gives the error upon reading the opening bracket for encoding=html.
> That's the only character that's giving me a problem. I have broken it up
> into:
>
>
> ...
>
> #set{$D = '$'}
>
> #set{$VARIABLE = '{variable[encoding=html]}'}
>
> ${D}${VARIABLE}
>
> ...
>
>
> This works fine, but there's about a hundred different locations that a
> variation of this code is listed in the files and I'm hoping there's an
> easier way to manage it. Can you just list certain characters to ignore in
> the template, or some variation of this? Thank you!
> --
> View this message in context: http://old.nabble.com/Is-it-possible-to-have-velocity-ignore-certain-characters--tp33979774p33979774.html
> Sent from the Velocity - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message