# HG changeset patch # User hodgestar # Date 1314708728 0 # Node ID 6492fab2229aa22b94a40e4c2d6603d1ae6f2f0d # Parent 5c7d69204287a276a5395db9e4ff2cc7b333da73 Merge r1170 from trunk (fix error in match template processing -- see #370 comment 12). diff --git a/genshi/template/markup.py b/genshi/template/markup.py --- a/genshi/template/markup.py +++ b/genshi/template/markup.py @@ -385,10 +385,11 @@ for event in content: pass - # Let the remaining match templates know about the last - # event in the matched content, so they can update their + # Let this match template and the remaining match + # templates know about the last event in the + # matched content, so they can update their # internal state accordingly - for test in [mt[0] for mt in match_templates[idx + 1:]]: + for test in [mt[0] for mt in match_templates[idx:]]: test(tail[0], namespaces, ctxt, updateonly=True) break 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 @@ -1005,6 +1005,27 @@ """, tmpl.generate().render()) + def test_match_multiple_times3(self): + # See http://genshi.edgewall.org/ticket/370#comment:12 + tmpl = MarkupTemplate(""" + + + + + + + + + + """) + self.assertEqual("""\n + + + + + + """, tmpl.generate().render()) + # FIXME #def test_match_after_step(self): # tmpl = MarkupTemplate("""