Skip to content

Deprecation: legacy macro

Taylor Hunt edited this page Aug 2, 2019 · 9 revisions

The <macro> core tag’s syntax has changed to be consistent with the new tag parameters, for providing values to body content.

The old syntax:

<macro greeting(firstName, lastName)>
  Hello ${firstName} ${lastName}!
</macro>

<greeting firstName="Michael" lastName="Rawlings"/>
<greeting("Michael", "Rawlings"/>

…now looks like this:

<macro|{ firstName, lastName }| name="greeting">
  Hello ${firstName} ${lastName}!
</macro>

<greeting firstName="Michael" lastName="Rawlings"/>

<macro-body>

The <macro-body> tag is now unnecessary, as the parameters provided to <macro> are consistent with those provided to a template. You can render the body content of the modern <macro> tag like so:

<macro|{ renderBody }| name="heading">
  <h1 class="fancy-heading">
    <${renderBody}/>
  </h1>
</macro>

<heading>Hello!</heading>