Edgewall Software

Changeset 1149


Ignore:
Timestamp:
Dec 13, 2010, 8:07:59 PM (13 years ago)
Author:
jruigrok
Message:

Pull up r1146 to trunk.

Addresses #399

Location:
trunk/genshi/template
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/genshi/template/markup.py

    r1120 r1149  
    309309        match_templates = ctxt._match_templates
    310310
    311         tail = []
    312         def _strip(stream, append=tail.append):
     311        def _strip(stream, append):
    313312            depth = 1
    314313            next = stream.next
     
    354353                    if 'match_once' not in hints and 'not_recursive' in hints:
    355354                        pre_end -= 1
    356                     inner = _strip(stream)
     355                    tail = []
     356                    inner = _strip(stream, tail.append)
    357357                    if pre_end > 0:
    358358                        inner = self._match(inner, ctxt, start=start,
  • trunk/genshi/template/tests/markup.py

    r1088 r1149  
    733733        </html>""", tmpl.generate().render(encoding=None))
    734734
     735    def test_match_tail_handling(self):
     736        # See <http://genshi.edgewall.org/ticket/399>
     737        xml = ("""<rhyme xmlns:py="http://genshi.edgewall.org/">
     738          <py:match path="*[@type]">
     739            ${select('.')}
     740          </py:match>
     741
     742          <lines>
     743            <first type="one">fish</first>
     744            <second type="two">fish</second>
     745            <third type="red">fish</third>
     746            <fourth type="blue">fish</fourth>
     747          </lines>
     748        </rhyme>""")
     749        tmpl = MarkupTemplate(xml, filename='test.html')
     750        self.assertEqual("""<rhyme>
     751          <lines>
     752            <first type="one">fish</first>
     753            <second type="two">fish</second>
     754            <third type="red">fish</third>
     755            <fourth type="blue">fish</fourth>
     756          </lines>
     757        </rhyme>""", tmpl.generate().render(encoding=None))
     758
    735759
    736760def suite():
Note: See TracChangeset for help on using the changeset viewer.