在 Freemarker 中禁用解释器
Disable interpreter in Freemarker
我必须在包含大量语法的 freemarker 模板中编写一个部分,freemarker 可以解释这些语法,但不应该。是否有类似 <noformat>
标签的东西告诉 freemarker 不要解释给定部分中的语法?
有一个 #noparse directive 可以满足您的需求。
FreeMarker will not search FTL tags and interpolations and other special character sequences in the body of this directive, except the noparse end-tag.
Template
Example:
--------
<#noparse>
<#list animals as animal>
<tr><td>${animal.name}<td>${animal.price} Euros
</#list>
</#noparse>
Output
Example:
--------
<#list animals as animal>
<tr><td>${animal.name}<td>${animal.price} Euros
</#list>
我必须在包含大量语法的 freemarker 模板中编写一个部分,freemarker 可以解释这些语法,但不应该。是否有类似 <noformat>
标签的东西告诉 freemarker 不要解释给定部分中的语法?
有一个 #noparse directive 可以满足您的需求。
FreeMarker will not search FTL tags and interpolations and other special character sequences in the body of this directive, except the noparse end-tag.
Template
Example: -------- <#noparse> <#list animals as animal> <tr><td>${animal.name}<td>${animal.price} Euros </#list> </#noparse>
Output
Example: -------- <#list animals as animal> <tr><td>${animal.name}<td>${animal.price} Euros </#list>