-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Description
When I use include ... without context inside a macro like this:
import jinja2
print(
jinja2.Environment(
loader=jinja2.DictLoader(
{
"included": "foo",
"main": """
{%- macro foo() %}
{%- include "included" without context %}
{%- endmacro %}
{{- foo() -}}
""",
}
),
)
.get_template("main")
.render()
)The macro evaluates to something that looks like a repr() string instead of the contents of the included template:
$ python3 foo.py
<generator object root.<locals>.macro at 0x7f79f60a0580>
The same include line works outside of a macro, and it works inside the macro if I remove without context:
$ python3 foo.py
foo
Environment:
- Python version: 3.13.5
- Jinja version: 3.1.6-1
Metadata
Metadata
Assignees
Labels
No labels