velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Reck <>
Subject Re: Escaping braindead :) + proposal
Date Tue, 19 Mar 2002 09:21:15 GMT
I agree with Geir on the current idea of references should be known
beforehand. Thus any character stream can be passed trough Vel.

The escaping hack came in later to allow something like \$reference 
to emit the plain $. People have been asking to escape quotes in 
strings, but has been voted down.

The simple solution is to put in a #set( $D = '$' ) and use that
format notaion ${D}refernces to enusre a dollar sign is in the
right place. Same works for quotes. This maybe doesn't look as
clean, but it is failsafe and works properly as expected.

The observations of Daniel Dekany with the current escaping 
behaviour must be checked:
 \##x -> \
 \#\#x -> \#\#x
Here the issue is the priority of comments, to mee the behavious 
is consitent; again: you can use 
 #set( $H = '#' ) 
 ${H}${H}x -> ##x

And the tree swallowing escapes:
is another strange one!?
If one uses some formal escape symbol reference it would work 
properly (but looks strange):
 #set( $E = '\' )

So the conclusion is that escaping was hacked in to make some 
people happy, but has strange effects. 

Other noted bugs are: $#**#foo and $mytool.dollar()foo trying 
to access the $foo reference.

I miss some #local( list of vars ) ... #end directive to make
localy defined/used references dissapear after the block.
I know this would be *very* easy to implement (just stripping
the #foreach directive), but it should be part of the velocity
distribution. It would make macros less dependant on callers
and side-effects.

The whitespace issue/prposal is open in another thread...

:) Christoph Reck

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

View raw message