# HG changeset patch
# User cmlenz
# Date 1181738350 0
# Node ID c8b6d3c0d389c2cb6aaf5804f05ffbc24c78f59e
# Parent 1c9250cc4365038deda02a8a37550fee53bf2322
Ported [624] to 0.4.x branch.
diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,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 `` processing instruction containing trailing whitespace no
+ longer causes a syntax error (ticket #127).
Version 0.4.1
diff --git a/genshi/template/markup.py b/genshi/template/markup.py
--- a/genshi/template/markup.py
+++ b/genshi/template/markup.py
@@ -194,7 +194,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()])
diff --git a/genshi/template/tests/markup.py b/genshi/template/tests/markup.py
--- a/genshi/template/tests/markup.py
+++ b/genshi/template/tests/markup.py
@@ -195,6 +195,17 @@
\xf6
""", 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"""