diff --git a/hyde/ext/templates/jinja.py b/hyde/ext/templates/jinja.py index f3327e2..ed8e83b 100644 --- a/hyde/ext/templates/jinja.py +++ b/hyde/ext/templates/jinja.py @@ -265,7 +265,13 @@ class Refer(Extension): includeNode.ignore_missing = False includeNode.template = template + temp = parser.free_identifier(lineno) + return [ + nodes.Assign( + nodes.Name(temp.name, 'store'), + nodes.Name(MARKINGS, 'load') + ).set_lineno(lineno), nodes.Assign( nodes.Name(MARKINGS, 'store'), nodes.Const({})).set_lineno(lineno), @@ -295,6 +301,10 @@ class Refer(Extension): nodes.Getitem(nodes.Name(namespace, 'load'), nodes.Const('parent_resource'), 'load') ).set_lineno(lineno), + nodes.Assign( + nodes.Name(MARKINGS, 'store'), + nodes.Name(temp.name, 'load') + ).set_lineno(lineno), ] def _push_resource(self, namespace, site, resource, template, caller): diff --git a/hyde/tests/test_jinja2template.py b/hyde/tests/test_jinja2template.py index 27b6e1b..652cfff 100644 --- a/hyde/tests/test_jinja2template.py +++ b/hyde/tests/test_jinja2template.py @@ -128,6 +128,7 @@ def assert_markdown_typogrify_processed_well(include_text, includer_text): gen.load_template_if_needed() template = gen.template html = template.render(includer_text, {}).strip() + print html assert html q = PyQuery(html) assert "is_processable" not in html @@ -200,7 +201,7 @@ class TestJinjaTemplate(object): deps = list(t.get_dependencies('inc.md')) assert len(deps) == 1 - + assert not deps[0] @@ -314,6 +315,52 @@ Hyde & Jinja. assert "mark" not in html assert "reference" not in html + def test_two_level_refer_with_var(self): + text = """ +=== +is_processable: False +=== +