⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 escape2.vm

📁 velocity 的脚本语言的全部代码集合
💻 VM
字号:
#*@test escape2.vmMore interesting cases...This template is used for Velocity regression testing.If you alter this template make sure you change thecorresponding comparison file so that the regressiontest doesn't fail incorrectly.*#--- Schmoo ---These are not in the context, so they should render as they are here (schmoo).$foo\$foo\\$foo\#woogie\\#woogie\\\#woogieNow put $foo in the context :#set($foo = "bar")\$foo = $foo\\\$foo =\\$foo\\\\\$foo =\\\\$fooAs we increase the number of \'s, we alternate renderings :$foo\$foo\\$foo\\\$foo\\\\$foo--- Pluggable Directives ----We are doing an \#include("test.txt"), starting with 0 '\' preceeding :#include("test.txt")\#include("test.txt")\\#include("test.txt")\\\#include("test.txt")\\\\#include("test.txt")Now, foreach is a PD.  Escape the first one, and then not the second so itrenders.  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(\\#foreach($a in $stringarray) $a \\#end\\#foreach($a in $stringarray) $a \ \\#end\\#foreach($a in $stringarray)$a\ \\#end--- Control Structures ----First should be escaped...\#if(true) hi \#endThis isn't.  Note then that it has to render the \\ as a \ because it's stuck to the VTL\\#if(true) hi \\#end\\#if(true) hi #endAnd so forth...\\\#if(true) hi \\\#end\\\\#if(true) hi \\\\#endAnd more...\#if(true)	hi\#else	there\#end\\#if(true)	hi\\#else	there\\#end\\\#if(true)	hi\\\#else	there\\\#end\\#if(false)	hi\\#elseif(true)	there\\#end\\\#if(false)	hi\\\#elseif(true)	there\\\#end## testing combinations like #$foo#$foo1\#$foo1#${foo1}\#$${foo1}#set($foo1 = "C0C0C0")#$foo1\#$foo1#${foo1}\#$${foo1}#\$${foo1}## and wacky stuff that are not references, but## because of the MORE tokens, get screwed up$(QUERY_STRING{forumid})\$(QUERY_STRING{forumid})\\$(QUERY_STRING{forumid})####  and just slashes....##\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -