# HG changeset patch
# User cmlenz
# Date 1181738350 0
# Node ID dc8646e2e9184739c02313b6bcc96dbddaf13986
# Parent e57be40ff6c36c85ff29cfcd20841f4a9f6df606
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"""