Hi Jens,

velocity acts differently if $foo is in the context or not.

The documentation example you quoted seems to be for the
case where the key "foo" was in the context, in which case
the presented reply in this thread from "trad-ex" user is
more correct.

When $foo is not in the context I would expect the last line
\\$!{foo} to render as (collating the backslash): \$!{foo}
but the behavior of "escaping an escape" is broken and
many times produces unexpected/unexplainable output.

I recommend you use the poor-mans-escaping(TM) velocity gives
you for free:
#set( $D = '$' )
#set( $B = '\' )
#set( $H = '#' )
#set( $N = '!' )
Now you can write things like $B$D$N{foo} to precisely render
what you want. Note that you would only need to escape the $
in such a case: \$D!{foo} which is almost as readable as \\$!{foo}

Cheers,
Christoph

P.S. Jens, be aware, if you write to mailing lists with your
business email address, you will later receive a *lot* of
spam - because lists are electronically harvested by bad guys
for good addresses... You will then see how good/bad BMW
IT-Infrastructure is filtering out the spam...

[EMAIL PROTECTED] wrote:
Hello,

i think you have a mistake in "Advanced Issues: Escaping and !"

Original Text:

Contrast this with regular escaping, where \ precedes $:
\$foo
\$!foo
\$!{foo}
\\$!{foo}

This renders as:
\$foo
\$!foo
\$!{foo}
\bar
I think it should be like this: (Change is marked red)


Contrast this with regular escaping, where \ precedes $:
\$foo
\$!foo
\$!{foo}
\\$!{foo}

This renders as:
$foo
\$!foo
\$!{foo}
\bar


Best regards
Jens Futterer

------------------------------------------
BMW Group
Jens Futterer
Diplomand EG-660
Versuch und Modelltechnik/Prozesse und Simulation

Telefon: +49 (0) 89 / 382-78182

mailto: [EMAIL PROTECTED]

URL: http://www.bmwgroup.com <http://www.bmwgroup.com>
-------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to