-
Notifications
You must be signed in to change notification settings - Fork 639
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
Context lost in nested macro if macro was not imported. #1337
Comments
Try to call |
Thanks for the response. Do you have an example? Because my problem is for the case where all macro's are in the same file (example 1) and I'm already not having problems when I use import (example 2). |
Oh, you right, it seems not related to context. |
I have inspected precompiled templates. It seems that every
Looks like it is intended behaviour to preserve nunjucks/nunjucks/src/compiler.js Line 865 in f91f1c3
New frame created and used as I guess it would be more correct to pass |
When I try to call a macro from inside another macro and both macros reside in the same file, the parent context seems to be lost, unless the inner macro is imported implicitly. This is not the case for imported macro's and even is solved by manually importing the current file into a new variable.
Example that doesn't work as expected:
The variables "not_shown" and "x" are not displayed in the final template, but "Only this is shown" is.
file2.html:
Example that works as expected:
file2.html:
The text was updated successfully, but these errors were encountered: