comparison markup/template.py @ 73:b0fd16111f2e

Some more performance tweaks.
author cmlenz
date Wed, 12 Jul 2006 18:47:39 +0000
parents 0334bca326df
children 3c271699c398
comparison
equal deleted inserted replaced
72:29f22f4fd583 73:b0fd16111f2e
894 # Consume and store all events until an end event 894 # Consume and store all events until an end event
895 # corresponding to this start event is encountered 895 # corresponding to this start event is encountered
896 content = [(kind, data, pos)] 896 content = [(kind, data, pos)]
897 depth = 1 897 depth = 1
898 while depth > 0: 898 while depth > 0:
899 ev = stream.next() 899 kind, data, pos = stream.next()
900 depth += {START: 1, END: -1}.get(ev[0], 0) 900 if kind is START:
901 content.append(ev) 901 depth += 1
902 test(*ev) 902 elif kind is END:
903 depth -= 1
904 content.append((kind, data, pos))
905 test(kind, data, pos)
903 906
904 content = list(self._flatten(content, ctxt)) 907 content = list(self._flatten(content, ctxt))
905 ctxt.push(select=lambda path: Stream(content).select(path)) 908 ctxt.push(select=lambda path: Stream(content).select(path))
906 909
907 if directives: 910 if directives:
Copyright (C) 2012-2017 Edgewall Software