Mercurial > genshi > genshi-test
diff markup/template.py @ 73:b0fd16111f2e
Some more performance tweaks.
author | cmlenz |
---|---|
date | Wed, 12 Jul 2006 18:47:39 +0000 |
parents | 0334bca326df |
children | 3c271699c398 |
line wrap: on
line diff
--- a/markup/template.py +++ b/markup/template.py @@ -896,10 +896,13 @@ content = [(kind, data, pos)] depth = 1 while depth > 0: - ev = stream.next() - depth += {START: 1, END: -1}.get(ev[0], 0) - content.append(ev) - test(*ev) + kind, data, pos = stream.next() + if kind is START: + depth += 1 + elif kind is END: + depth -= 1 + content.append((kind, data, pos)) + test(kind, data, pos) content = list(self._flatten(content, ctxt)) ctxt.push(select=lambda path: Stream(content).select(path))