Merge 88d7e7bef8 into 284501eb0f
This commit is contained in:
commit
f494ce7e4c
@ -1092,7 +1092,11 @@ class CodeGenerator(NodeVisitor):
|
||||
)
|
||||
loop_body()
|
||||
else:
|
||||
self.writeline("yield from template._get_default_module()._body_stream")
|
||||
if frame.buffer is None:
|
||||
self.writeline("yield from template._get_default_module()._body_stream")
|
||||
else:
|
||||
self.writeline("for event in template._get_default_module()._body_stream:")
|
||||
loop_body()
|
||||
|
||||
if node.ignore_missing:
|
||||
self.outdent()
|
||||
|
||||
@ -195,6 +195,18 @@ class TestIncludes:
|
||||
)
|
||||
assert t.render().strip() == "(FOO)"
|
||||
|
||||
def test_include_without_context_inside_macro(self, test_env):
|
||||
test_env.loader.mapping["included"] = "foo"
|
||||
t = test_env.from_string(
|
||||
"""
|
||||
{%- macro foo() %}
|
||||
{%- include "included" without context %}
|
||||
{%- endmacro %}
|
||||
{{- foo() -}}
|
||||
"""
|
||||
)
|
||||
assert t.render() == "foo"
|
||||
|
||||
def test_import_from_with_context(self):
|
||||
env = Environment(
|
||||
loader=DictLoader({"a": "{% macro x() %}{{ foobar }}{% endmacro %}"})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user