Re: Is it possible to have velocity ignore certain characters?

Nathan Bubna <[email protected]>
Newsgroups gmane.comp.jakarta.velocity.user
Message-ID <CAFyaDjFzQDaZQV0B8+YmD0CEb5ZmYfyy9r44sPQMrpQF=EdE2Q@mail.gmail.com>
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
<[email protected]> 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.