From: Armin Ronacher Date: Thu, 18 Oct 2007 22:21:08 +0000 (+0200) Subject: fixed #281 and added test case X-Git-Tag: 2.0rc1~257^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9cdf3bfd7f83e15c34fd887d2f3de0479cc77355;p=jinja2.git fixed #281 and added test case --HG-- branch : trunk --- 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'