fixed #281 and added test case
authorArmin Ronacher <armin.ronacher@active-4.com>
Thu, 18 Oct 2007 22:21:08 +0000 (00:21 +0200)
committerArmin Ronacher <armin.ronacher@active-4.com>
Thu, 18 Oct 2007 22:21:08 +0000 (00:21 +0200)
--HG--
branch : trunk

jinja/parser.py
tests/test_inheritance.py

index dd7aa8263e2748b7865ce62459e4b49ba5f78201..a3a8347e49e1b019436cc59d9d7bc39dc7e2f783 100644 (file)
@@ -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
index 2e5e8a536a8b3a5abbbfee033ed84c51b1f4b6fa..64ec76d97d896db067a04846cf88ba634a4e798f 100644 (file)
@@ -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'