You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- added "preprocessor" argument to Template, TemplateLookup - is a single
callable or list of callables which will be applied to the template text
before lexing. given the text as an argument, returns the new text.
- added mako.ext.preprocessors package, contains one preprocessor so far:
'convert_comments', which will convert single # comments to the new ##
format
Copy file name to clipboardExpand all lines: test/lexer.py
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@
4
4
frommakoimportexceptions
5
5
fromutilimportflatten_result, result_lines
6
6
frommako.templateimportTemplate
7
+
importre
7
8
8
9
classLexerTest(unittest.TestCase):
9
10
deftest_text_and_tag(self):
@@ -376,6 +377,17 @@ def test_comments(self):
376
377
"""
377
378
nodes=Lexer(template).parse()
378
379
assertrepr(nodes) ==r"""TemplateNode({}, [Text(u'\n<style>\n #someselector\n # other non comment stuff\n</style>\n', (1, 1)), Comment(u'a comment', (6, 1)), Text(u'\n# also not a comment\n\n', (7, 1)), Comment(u'this is a comment', (10, 1)), Text(u' \nthis is ## not a comment\n\n', (11, 1)), Comment(u' multiline\ncomment\n', (14, 1)), Text(u'\n\nhi\n', (16, 8))])"""
0 commit comments