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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -