pongo2 icon indicating copy to clipboard operation
pongo2 copied to clipboard

Feature request: Specify argument names while calling macro

Open iredmail opened this issue 4 years ago • 1 comments

Let's say we have a macro like this:

{% macro greetings(to, from=name, name2="guest") %} ... {% endmacro %}

Currently we can only call it like this (copied from template_tests/macro.tpl):

{{ greetings() }}
{{ greetings(10) }}
{{ greetings("john") }}
{{ greetings("john", "michelle") }}
{{ greetings("john", "michelle", "johann") }}

It should be more useful to call it with argument names, especially when the macro has more arguments:

{{ greetings(to="john") }}
{{ greetings("john", from="michelle") }}
{{ greetings("john", name2="michelle", from="johann") }}

We try to organize some reusable HTML/CSS code lines to a macro, and it accepts multiple arguments. But currently the macro is not suitable for this task because hard to remember all arguments while calling the macro.

iredmail avatar Mar 25 '21 01:03 iredmail

Hello @flosch, is there any update on this? Or can you point me in the right direction to start working on this?

vblinden avatar Jul 18 '23 12:07 vblinden