While looking over list traffic, I saw that Daniel Rall pointed out a
small, subtle error in the testbed, having to do with how \ is
processed. The actual issue isn't specifically important. But it got
me to think about this, and I would like to (well, am already..) make a
change.
Currently, the VTL parser is such that any \ is presumed to be an escape
character, whether or not it is part of a VTL construct ( i.e. accessing
a reference or directive ). The real effect on end users is that adding
VTL to existing content requires a global modifications, namely
replacing \ with \\, and I think that this is unreasonable.
For example, if ASCII art was back in vogue, and you were generating
html code like :
/\/\/\
| Hi!|
\/\/\/
and you just ran that through the parser you would get :
///
| Hi |
///
or had some Java :
String strPath = "e:\\winnt\\system32\\";
through Vel :
String strPath = "e:\winnt\system32\";
The point is that you can't simply take existing content and use it in
Velocity w/o modifying the 'shmoo', the non-VTL portions of the
template. I think that is a requirement that shouldn't be...
Proposal :
I am going to remove this functionality, and make the \ an escape
character only in the following situations :
1) Whenever you are using a string literal in VTL :
#set $foo = [ "that\'s", "this" ]
2) Whenever you wish to 'show your underwear' -> when you specifically
wish to show the literal string for something that is a valid in-context
reference or a directive:
VTL : The value of \$foo is $foo.
output : The value of $foo is <value_of_foo>.
VTL : The function to use is \#foreach
output : The function to use is #foreach
3) NOTE : It will not act as an escape when you have something that
looks like a reference or directive, but isn't :
VTL : The VTL construct to show a reference is \$reference.
output : The VTL construct to show a reference is \$reference.
VTL : The VTL construct to show a directive is \#directivename
output : The VTL construct to show a directive is \#directivename
(the above assumes that 'reference' is not in the context, and
'direcivename' isn't a directive)
Summary : I think the only changes a template author should have to make
to a template's contents is the addition of the VTL references and
directive structures, and I think this does it. Does this work? Did I
miss anything? All comments welcome (the sooner the better...)
geir
--
Geir Magnusson Jr. [EMAIL PROTECTED]
Dakota tribal wisdom: "when you discover you are riding a dead horse,
the best strategy is to dismount."