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 of s).
  • as template fragment evaluated multiple types in example, have assigned result of ?interpret local variable, otherwise write <@s?interpret />.
  • as of r before string literal, tells freemarker ${} (and \ escapes) must not interpreted.

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -