macros - Pause interpolation of template string in FTL -
i want pass dynamic string ftl macro. don't want template string interpolated when calling macro ftl. want template string interpolated inside macro only. can make macro reusable sending dynamic template strings parameter. new apache ftl don't have idea how proceed.
not sure want achieve, guess this:
<#macro m s> <#local parseds = s?interpret> <#list ['john doe', 'jane doe'] name> <p><@parseds /> </#list> </#macro> <@m r"hello ${name}!" /> which print:
<p>hello john doe! <p>hello jane doe! some notes:
- i haven't used parameter string interpolation, template fragment (so auto-escaping, if use it, applied, use
#if, such in value ofs). - as template fragment evaluated multiple types in example, have assigned result of
?interpretlocal variable, otherwise write<@s?interpret />. - as of
rbefore string literal, tells freemarker${}(and\escapes) must not interpreted.
Comments
Post a Comment