Synopsis
<#autoesc>
...
</#autoesc>
Camel case name variant: autoEsc
Description
Turns on auto-escaping in the nested
section. Auto-escaping is usually enabled by default if the current
output
format has auto-escaping by default, so you rarely need this.
Note that to escape just a single
${expression}
where
auto-escaping is disabled you should use
${expression?esc}
instead.
This directive only has effect on the section that is literally (as in the text editor) inside the nested bock, not on the parts that are called/included from there.
Example:
<#ftl output_format="XML" auto_esc=false> ${"&"} <#autoesc> ${"&"} ... ${"&"} </#autoesc> ${"&"}
& & ... & &
autoesc
can't be used where the current
output
format is a non-markup output
format (and hence can't do escaping). Doing so is a parse-time error.
autoesc
can also be used nested into noautoesc
directive to re-enable auto-escaping.
autoesc
can be used on places where
auto-escaping is already enabled, such as even inside another
autoesc
block. Doing so is redundant but
allowed.