We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Version: github.com/flosch/pongo2/v6 v6.0.0
github.com/flosch/pongo2/v6 v6.0.0
I have a macro main which i want to use in my templates. To implement this macro, i rely on child macros -child.
main
child
{% macro child() %}Child{% endmacro %} {% macro main() export %}Main calls {{ child() }}{% endmacro %}
main does not work correctly when imported.
Create macros.j2 with the contents above.
macros.j2
Create test1.j2 with the following contents:
test1.j2
{# filename: test1.j2 #} {% import "macros.j2" main %} {{ main() }}
Main calls
Expected output:
Main calls Child
When the macro is called from the same file such as below, we get the expected output:
{# filename: test2.j2 #} {# macro definition above is pasted here #} {{ main() }}
The text was updated successfully, but these errors were encountered:
#331 contains a working solution
Sorry, something went wrong.
rework macro imports
15b9d6b
fixes flosch#330
No branches or pull requests
Version:
github.com/flosch/pongo2/v6 v6.0.0
Background
I have a macro
main
which i want to use in my templates. To implement this macro, i rely on child macros -child
.What is the issue
main
does not work correctly when imported.How to reproduce ?
Create
macros.j2
with the contents above.Create
test1.j2
with the following contents:test1.j2
using the default options. We get the following output:Expected output:
Other details (may be useful)
When the macro is called from the same file such as below, we get the expected output:
The text was updated successfully, but these errors were encountered: