]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Document and test `{#!` syntax.
authorBen Darnell <ben@bendarnell.com>
Sun, 14 Feb 2016 03:30:50 +0000 (22:30 -0500)
committerBen Darnell <ben@bendarnell.com>
Sun, 14 Feb 2016 03:30:50 +0000 (22:30 -0500)
Fixes #1606

tornado/template.py
tornado/test/template_test.py

index c7f26eff7870305c036c671716de7bf8140a3a0e..499cc242ca339624dbe0be8ecfff3678c52b5784 100644 (file)
@@ -94,12 +94,15 @@ Syntax Reference
 Template expressions are surrounded by double curly braces: ``{{ ... }}``.
 The contents may be any python expression, which will be escaped according
 to the current autoescape setting and inserted into the output.  Other
-template directives use ``{% %}``.  These tags may be escaped as ``{{!``
-and ``{%!`` if you need to include a literal ``{{`` or ``{%`` in the output.
+template directives use ``{% %}``.
 
 To comment out a section so that it is omitted from the output, surround it
 with ``{# ... #}``.
 
+These tags may be escaped as ``{{!``, ``{%!``, and ``{#!``
+if you need to include a literal ``{{``, ``{%``, or ``{#`` in the output.
+
+
 ``{% apply *function* %}...{% end %}``
     Applies a function to the output of all template code between ``apply``
     and ``end``::
index 7b21ce754968890e7e84e31457f409c3a1fe68e8..ad5ac71ef46978cf73e9db75ad5e728a35dc599b 100644 (file)
@@ -67,6 +67,7 @@ class TemplateTest(unittest.TestCase):
         self.assertRaises(ParseError, lambda: Template("{%"))
         self.assertEqual(Template("{{!").generate(), b"{{")
         self.assertEqual(Template("{%!").generate(), b"{%")
+        self.assertEqual(Template("{#!").generate(), b"{#")
         self.assertEqual(Template("{{ 'expr' }} {{!jquery expr}}").generate(),
                          b"expr {{jquery expr}}")