You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ge...@locus.apache.org on 2000/11/07 22:37:49 UTC
cvs commit: jakarta-velocity/test/templates/compare escape2.cmp
geirm 00/11/07 13:37:46
Added: test/templates/compare escape2.cmp
Log:
Compare file for escape2.vm for JUnit testbed.
Revision Changes Path
1.1 jakarta-velocity/test/templates/compare/escape2.cmp
Index: escape2.cmp
===================================================================
--- Schmoo ---
These are not in the context, so they should render as they are here (schmoo).
$foo
\$foo
\\$foo
\#woogie
\\#woogie
\\\#woogie
Now put $foo in the context :
$foo = bar
\$foo =\bar
\\$foo =\\bar
As we increase the number of \'s, we alternate renderings :
bar
$foo
\bar
\$foo
\\bar
--- Pluggable Directives ----
We are doing an #include("test.txt"), starting with 0 '\' preceeding :
--text--
#include("test.txt")
\--text--
\#include("test.txt")
\\--text--
Now, foreach is a PD. Escape the first one, and then not the second so it
renders. The third and fourth examples show the single 'unpleasantry' about this. The \
is only an escape when 'touching' VTL, otherwise, it's just schmoo.
#foreach(
\ first element \ second element \
\ first element \ \ second element \ \
\first element\ \second element\ \
--- Control Structures ----
First should be escaped...
#if(true) hi #end
This isn't. Note then that it has to render the \\ as a \ because it's stuck to the VTL
\ hi \
\ hi
And so forth...
\#if(true) hi \#end
\\ hi \\
And more...
#if(true)
hi
#else
there
#end
\ hi
\\
\#if(true)
hi
\#else
there
\#end
\\ there
\
\#if(false)
hi
\#elseif(true)
there
\#end