velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Dekany" <ddek...@freemail.hu>
Subject Re: Escaping braindead :) + proposal
Date Tue, 19 Mar 2002 18:25:08 GMT
On Tuesday, March 19, 2002 10:21 AM "Christoph Reck" <Christoph.Reck@dlr.de>
writen:


[snip]
> 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.

[snip]

I feel that the key problem (not my problem in practice BTW) with this
solution is that I can't express "print a dollar literally" in VTL
independly of the context, since the VTL fragment will assume that D exists
in the context, and that it will print a dollar. Thus I can't do plain
text -> VTL-fragment transformation in a portable way.
So perhaps the current escaping rule should not changed at all (however I
*hate* it...), but then at least add something to Velocity core that can do
the job of ${D} and ${H} and ${B}. Perhaps add #echo(valueToPrintLiterally)
so I can write #echo('$'),
or even #echo("#stop $the \$evil ###schomoos\\\")? Awkward but I have no
better idea for now...
<offtopic>
However, if you combine it with whitespace eating directives (they are not
existing today, but I hope in the near future all directive will eat
whitespace like #set does now (sweet dreams... :))) it can be useful in a
different way too:

#echo('a')
#if ($foo)
  #echo('b')
    #if ($baar)
      #echo('c')
    #end
#end
d

can print abcd.
</offtopic>

I know... -1 of course. What else? :)


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


Mime
View raw message