From 9cdf3bfd7f83e15c34fd887d2f3de0479cc77355 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Fri, 19 Oct 2007 00:21:08 +0200 Subject: [PATCH] fixed #281 and added test case --HG-- branch : trunk --- jinja/parser.py | 5 +++-- tests/test_inheritance.py | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/jinja/parser.py b/jinja/parser.py index dd7aa82..a3a8347 100644 --- a/jinja/parser.py +++ b/jinja/parser.py @@ -309,8 +309,9 @@ class Parser(object): if self.stream.current.type != 'block_end': lineno = self.stream.lineno - body = nodes.NodeList([self.parse_variable_tag()], lineno, - self.filename) + expr = self.parse_tuple_expression() + node = nodes.Print(expr, lineno, self.filename) + body = nodes.NodeList([node], lineno, self.filename) self.stream.expect('block_end') else: # otherwise parse the body and attach it to the block diff --git a/tests/test_inheritance.py b/tests/test_inheritance.py index 2e5e8a5..64ec76d 100644 --- a/tests/test_inheritance.py +++ b/tests/test_inheritance.py @@ -111,3 +111,8 @@ def test_broken(env): def test_working(env): tmpl = env.get_template('working') + + +def test_shortcut(env): + tmpl = env.from_string('{% block foo "42" %}') + assert tmpl.render() == '42' -- 2.26.2