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

Add support for macro argument default value #198

Open
GuillaumeGomez opened this issue Oct 8, 2024 · 4 comments
Open

Add support for macro argument default value #198

GuillaumeGomez opened this issue Oct 8, 2024 · 4 comments
Assignees

Comments

@GuillaumeGomez
Copy link
Contributor

It's possible in jinja to have default value for macro arguments:

{% macro input(name, value='', type='text', size=20) -%}
    <input type="{{ type }}" name="{{ name }}" value="{{value|e }}" size="{{ size }}">
{%- endmacro %}
@Kijewski
Copy link
Collaborator

Kijewski commented Oct 8, 2024

Should be easy enough to implement. What kind of default values would you allow? Only literals?

@GuillaumeGomez
Copy link
Contributor Author

For a first step I think it's enough. We can always add function calls or constructors later on.

Please leave this one to me. :p

@Kijewski
Copy link
Collaborator

Kijewski commented Oct 8, 2024

Please leave this one to me. :p

Hehe, I will. Have fun with it! :D

@GuillaumeGomez
Copy link
Contributor Author

Thanks! :D

@GuillaumeGomez GuillaumeGomez self-assigned this Oct 8, 2024
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