diff -r 36ec0c51e5e5 genshi/template/markup.py
|
a
|
b
|
|
| 358 | 358 | pre_end -= 1 |
| 359 | 359 | inner = _strip(stream) |
| 360 | 360 | if pre_end > 0: |
| 361 | | inner = self._match(inner, ctxt, end=pre_end, **vars) |
| | 361 | inner = self._match(inner, ctxt, start=start, end=pre_end, **vars) |
| 362 | 362 | content = self._include(chain([event], inner, tail), ctxt) |
| 363 | 363 | if 'not_buffered' not in hints: |
| 364 | 364 | content = list(content) |
diff -r 36ec0c51e5e5 genshi/template/tests/directives.py
|
a
|
b
|
|
| 961 | 961 | # Hello Dude |
| 962 | 962 | # </span> |
| 963 | 963 | # </div>""", tmpl.generate().render(encoding=None)) |
| | 964 | |
| | 965 | def test_triple_match_produces_no_duplicate_items(self): |
| | 966 | tmpl = MarkupTemplate("""<doc xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://genshi.edgewall.org/"> |
| | 967 | <div py:match="div[@id='content']" py:attrs="select('@*')" once="true"> |
| | 968 | <ul id="tabbed_pane" /> |
| | 969 | ${select('*')} |
| | 970 | </div> |
| | 971 | |
| | 972 | <body py:match="body" once="true" buffer="false"> |
| | 973 | ${select('*|text()')} |
| | 974 | </body> |
| | 975 | <body py:match="body" once="true" buffer="false"> |
| | 976 | ${select('*|text()')} |
| | 977 | </body> |
| | 978 | |
| | 979 | <body> |
| | 980 | <div id="content"> |
| | 981 | <h1>Ticket X</h1> |
| | 982 | </div> |
| | 983 | </body> |
| | 984 | </doc>""") |
| | 985 | output = tmpl.generate().render('xhtml', doctype='xhtml') |
| | 986 | matches = re.findall("tabbed_pane", output) |
| | 987 | self.assertNotEqual(None, matches) |
| | 988 | self.assertEqual(1, len(matches)) |
| 964 | 989 | |
| 965 | 990 | |
| 966 | 991 | class ContentDirectiveTestCase(unittest.TestCase): |