Creating a freemarker macro with optional nested content? -
what proper way create macro can used or without nested content? e.g.
<@mymacro/> <@mymacro>my nested content</@mymacro>
is there this? or else?
<#macro mymacro> <#if ??????> before nested content <#nested/> after nested content <#else/> nothing nested here </#if> </#macro>
the nested content assigned variable , variable checked if has content. variable sent output instead of using nested directive avoid content being processed twice.
<#macro mymacro> <#assign nested><#nested/></#assign> <#if nested?has_content> before nested content ${nested} after nested content <#else/> nothing nested here </#if> </#macro>
Comments
Post a Comment