diff markup/tests/template.py @ 89:d4c7617900e3

Support comments in templates that are not included in the output, in the same way Kid does: if the comment text starts with a `!` character, it is stripped from the output.
author cmlenz
date Mon, 17 Jul 2006 23:10:35 +0000
parents cc034182061e
children 242610137d1f
line wrap: on
line diff
--- a/markup/tests/template.py
+++ b/markup/tests/template.py
@@ -537,6 +537,22 @@
           bar
         </div>""", str(tmpl.generate(Context(myvar='"foo"'))))
 
+    def test_normal_comment(self):
+        tmpl = Template("""<div xmlns:py="http://markup.edgewall.org/">
+          <!-- foo bar -->
+        </div>""")
+        self.assertEqual("""<div>
+          <!-- foo bar -->
+        </div>""", str(tmpl.generate()))
+
+    def test_template_comment(self):
+        tmpl = Template("""<div xmlns:py="http://markup.edgewall.org/">
+          <!-- !foo -->
+          <!--!bar-->
+        </div>""")
+        self.assertEqual("""<div>
+        </div>""", str(tmpl.generate()))
+
 
 def suite():
     suite = unittest.TestSuite()
Copyright (C) 2012-2017 Edgewall Software