Mercurial > genshi > mirror
changeset 520:203bd6a3c93d trunk
Applied patch by Dale Sedivec to fix #127. Many thanks!
author | cmlenz |
---|---|
date | Wed, 13 Jun 2007 12:37:58 +0000 |
parents | 9e11fa7f4603 |
children | 082535e5087c |
files | ChangeLog genshi/template/markup.py genshi/template/tests/markup.py |
diffstat | 3 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,8 @@ * The I18n filter was not replacing the original attributes with the translation, but instead adding a second attribute with the same name. * `TextTemplate` can now handle unicode source (ticket #125). + * A `<?python ?>` processing instruction containing trailing whitespace no + longer causes a syntax error (ticket #127). Version 0.4.1
--- a/genshi/template/markup.py +++ b/genshi/template/markup.py @@ -193,7 +193,7 @@ # number quite right lines = [line.expandtabs() for line in data[1].splitlines()] first = lines[0] - rest = dedent('\n'.join(lines[1:])) + rest = dedent('\n'.join(lines[1:])).rstrip() if first.rstrip().endswith(':') and not rest[0].isspace(): rest = '\n'.join([' ' + line for line in rest.splitlines()])
--- a/genshi/template/tests/markup.py +++ b/genshi/template/tests/markup.py @@ -195,6 +195,17 @@ \xf6 </div>""", unicode(tmpl.generate())) + def test_exec_with_trailing_space(self): + """ + Verify that a code block processing instruction with trailing space + does not cause a syntax error (see ticket #127). + """ + MarkupTemplate(u"""<foo> + <?python + bar = 42 + ?> + </foo>""") + def test_exec_import(self): tmpl = MarkupTemplate(u"""<?python from datetime import timedelta ?> <div xmlns:py="http://genshi.edgewall.org/">