Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error passing named arguments to macros when using named imports #640

Open
brettatoms opened this issue Dec 12, 2022 · 1 comment
Open

Comments

@brettatoms
Copy link

Given the following macro saved in the file forms.html:

{% macro input(type="text") %}
    <input type="{{ type }}"  />
{% endmacro %}

If you import forms.html without assigning the import to a variable then using named arguments works fine, e.g:

{% import "forms" %}
{{ input(type="text") }}

But if you import forms.html and set it as a variable then passing named arguments throws a ParserException with the message "Can not use named arguments when calling a bean method", e.g.

{% import "forms" as forms %}
{{ forms.input(type="text") }}
@yanxiyue
Copy link
Contributor

current implementation does not support named arguments , you can work around like this:
···
{% import "forms" as forms %}
{{ forms.input("text") }}
···

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants