Syntax
argument ::= expression
Description
The data-use-macro statement replaces the statement element with a macro. The statement expression describes a macro definition.
In ZPT-JS the expression will generally be a path expression referring to a macro defined in another template. See data-define-macro for more information.
The effect of expanding a macro is to graft a subtree from another document (or from elsewhere in the current document) in place of the statement element, replacing the existing sub-tree. Parts of the original subtree may remain, grafted onto the new subtree, if the macro has slots. See data-define-slot for more information.
Note: some parts extracted from Zope Page Templates Reference.
Differences with ZPT
- In ZPT the syntax is argument ::= Name, so all invokations are literals. ZPT-JS uses expressions.
- Syntax of external macro invokation.
- There is no Zope tree in which to locate templates.
Examples
Invokation of copyright macro in the same file (internal macro invokation):
<p data-use-macro="'copyright'"> Macro goes here </p>
Invokation of copyright macro in macros.html file (external macro invokation):
<p data-use-macro="'copyright@macros.html'"> Macro goes here </p>
Invokation of macro defined by macroPath variable (it can be an internal or external macro invokation):
<p data-use-macro="macroPath"> Macro goes here </p>