This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Macro Transformation Template Samples

This article shows sample templates.

    Note: Macro transformation templates got more powerful with release v1.26.1. Make sure to use a current version.

    Simple Body Replacement

    Remove Macros without Body

    The following template replaces the macro by its body content, for a list of macros. If the macro has no body, it will be removed.

    {{!-- applyto:style,auibuttongroup,auibutton,div,bgcolor,alert,align,bibtex-reference,bibtex-display,center,clickable,auidialog,span,fancy-bullets,footnote,display-footnotes,highlight,auihorizontalnav,htmlcomment,img,table,tr,th,td,thead,tbody,iframe,latex-formatting,ol,li,ul,lozenge,auimessage,p,pre,privacy-policy,privacy-mark,auiprogress,auiprogressstepstatic,roundrect,search-box,span,tooltip,strike,copyright,reg-tm,sm,tm, --}}
    {{#if HasBody}}
        {{Body}}
    {{else}}
        {{RemoveMacro}}
    {{/if}}
    

    This preserves the macro body, even if it only consists of whitespace or line breaks.

    Remove Macros without Body, or with Empty Body

    If you want to remove such empty macro bodies as well, use the following approach, which also removes macros with empty body:

    {{!-- applyto:style,auibuttongroup,auibutton,div,bgcolor,alert,align,bibtex-reference,bibtex-display,center,clickable,auidialog,span,fancy-bullets,footnote,display-footnotes,highlight,auihorizontalnav,htmlcomment,img,table,tr,th,td,thead,tbody,iframe,latex-formatting,ol,li,ul,lozenge,auimessage,p,pre,privacy-policy,privacy-mark,auiprogress,auiprogressstepstatic,roundrect,search-box,span,tooltip,strike,copyright,reg-tm,sm,tm, --}}
    {{#if HasBody}}
        {{#unless IsMacroEmpty}}
            {{Body}}
        {{else}}
            {{RemoveMacro}}
        {{/unless}}
    {{else}}
        {{RemoveMacro}}
    {{/if}}