How to escape a # in velocity

谁说我不能喝 提交于 2019-11-30 07:48:49

this:

#[[
##
]]#

will yield:

##

anything within #[[ ... ]]# is unparsed.

Nathan Bubna

If you don't want to bother with the EscapeTool, you can do this:

#set( $H = '#' )
$H$H
Thomas

Add the esc tool to your toolbox and then you can use ${esc.hash}

${esc.h} will output # as per

this link

The set technique is a good way to get around any characters you need escaping, like if you want to have $name followed by "_lastname" then you can do:

set ($n = '_lastname)

and have this in your template:

$name$n

and it's all good.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!