# HG changeset patch # User cmlenz # Date 1266484665 0 # Node ID 1ea88e82713d08cdbcde9c6945b72c33a4cda971 # Parent 38c44e2f4232dcfaf71f3dac260e8ec0493977ea Apply patch Felix Schwarz that finally fixes the duplicated output in match template processing. Thanks so much! diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -13,12 +13,6 @@ by Marcin Kurczych during GSoC 2008. * Added caching in the serialization stage for improved performance. * Various improvements to the HTML sanitization filter. - - -Version 0.5.2 -http://svn.edgewall.org/repos/genshi/tags/0.5.2/ -(???, from branches/stable/0.5.x) - * Fix problem with I18n filter that would get confused by expressions in attribute values when inside an `i18n:msg` block (ticket #250). * Fix problem with the transformation filter dropping events after the @@ -32,6 +26,8 @@ * Fixed handling of relative URLs with fragment identifiers containing colons in the `HTMLSanitizer` (ticket #274). * Added an option to the `HTMLFiller` to also populate password fields. + * Match template processing no longer produces unwanted duplicate output in + some cases (ticket #254). Version 0.5.1 diff --git a/genshi/template/markup.py b/genshi/template/markup.py --- a/genshi/template/markup.py +++ b/genshi/template/markup.py @@ -358,7 +358,8 @@ pre_end -= 1 inner = _strip(stream) if pre_end > 0: - inner = self._match(inner, ctxt, end=pre_end, **vars) + inner = self._match(inner, ctxt, start=start, + end=pre_end, **vars) content = self._include(chain([event], inner, tail), ctxt) if 'not_buffered' not in hints: content = list(content) diff --git a/genshi/template/tests/directives.py b/genshi/template/tests/directives.py --- a/genshi/template/tests/directives.py +++ b/genshi/template/tests/directives.py @@ -12,6 +12,7 @@ # history and logs, available at http://genshi.edgewall.org/log/. import doctest +import re import sys import unittest @@ -947,6 +948,32 @@ """, tmpl.generate().render(encoding=None)) + # See http://genshi.edgewall.org/ticket/254/ + def test_triple_match_produces_no_duplicate_items(self): + tmpl = MarkupTemplate(""" +
+
+ + + ${select('*|text()')} + + + ${select('*|text()')} + + + +
+

Ticket X

+
+ +
""") + output = tmpl.generate().render('xhtml', doctype='xhtml') + matches = re.findall("tabbed_pane", output) + self.assertNotEqual(None, matches) + self.assertEqual(1, len(matches)) + # FIXME #def test_match_after_step(self): # tmpl = MarkupTemplate("""