What am I trying to do?
Based on the documentation, this is valid freemarker:
[#macro foo rest...]
[#-- do something with rest... --]
<div
[#list rest as key, val]
${key}="${val}"
[/#list]
>
</div>
[/#macro]
I want to be able to create a macro that passes rest...
to a child macro (e.g. foo), something like this:
[#macro bar rest...]
[#-- pass rest... to [@foo /] --]
[@foo
[#list rest as key, val]
${key}="${val}"
[/#list]
/]
[/#macro]
What I tried
Note: The following code snippet does not work, I tested this on https://try.freemarker.apache.org/.
[#macro foo rest...]
<div
[#list rest as key, val]
${key}="${val}"
[/#list]
>
</div>
[/#macro]
[#macro bar rest...]
[@foo
[#list rest as key, val]
${key}="${val}"
[/#list]
/]
[/#macro]
[@foo a="1" b="2" /]
[@bar c="3" d="4" /]
Expected Output:
<div a="1" b="2"></div>
<div c="3" d="4"></div>