# HG changeset patch # User cmlenz # Date 1164229243 0 # Node ID 0d749146842cbf54f4e05667579308246e0bc6fe # Parent 94ff33bfe515bfc781d7be8ccf5abef2f1877c71 Ported [444] to 0.3.x. diff --git a/genshi/path.py b/genshi/path.py --- a/genshi/path.py +++ b/genshi/path.py @@ -545,7 +545,7 @@ return '%s:*' % self.prefix class LocalNameTest(object): - """Node test that matches any event with the given prinipal type and + """Node test that matches any event with the given principal type and local name. """ __slots__ = ['principal_type', 'name'] @@ -562,7 +562,7 @@ return self.name class QualifiedNameTest(object): - """Node test that matches any event with the given prinipal type and + """Node test that matches any event with the given principal type and qualified name. """ __slots__ = ['principal_type', 'prefix', 'name'] diff --git a/genshi/template.py b/genshi/template.py --- a/genshi/template.py +++ b/genshi/template.py @@ -1140,8 +1140,9 @@ # Consume and store all events until an end event # corresponding to this start event is encountered - content = chain([(kind, data, pos)], - self._match(_strip(stream), ctxt), + content = chain([(kind, data, pos)], + self._match(_strip(stream), ctxt, + [match_templates[idx]]), tail) for filter_ in self.filters[3:]: content = filter_(content, ctxt) diff --git a/genshi/tests/template.py b/genshi/tests/template.py --- a/genshi/tests/template.py +++ b/genshi/tests/template.py @@ -590,6 +590,54 @@ """, str(tmpl.generate())) + def test_not_match_self(self): + """ + See http://genshi.edgewall.org/ticket/77 + """ + tmpl = MarkupTemplate(""" + +

+ ${select('text()')} + Goodbye! +

+ +

Hello!

+ + """) + self.assertEqual(""" +

+ Hello! + Goodbye! +

+ """, str(tmpl.generate())) + + def test_select_text_in_element(self): + """ + See http://genshi.edgewall.org/ticket/77#comment:1 + """ + tmpl = MarkupTemplate(""" + +

+ + ${select('text()')} + + Goodbye! +

+ +

Hello!

+ + """) + self.assertEqual(""" +

+ + Hello! + + Goodbye! +

+ """, str(tmpl.generate())) + def test_select_all_attrs(self): tmpl = MarkupTemplate("""