Mercurial > hg
comparison hgext/highlight.py @ 6196:fc9535ae6fe2
highlight: use iter() instead of generator comprehension
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Fri, 29 Feb 2008 11:13:50 -0800 |
parents | fe54e7501de1 |
children | f6565f7d9489 |
comparison
equal
deleted
inserted
replaced
6195:272fd5fa576d | 6196:fc9535ae6fe2 |
---|---|
71 | 71 |
72 colorized = highlight(text, lexer, formatter) | 72 colorized = highlight(text, lexer, formatter) |
73 # strip wrapping div | 73 # strip wrapping div |
74 colorized = colorized[:colorized.find('\n</pre>')] | 74 colorized = colorized[:colorized.find('\n</pre>')] |
75 colorized = colorized[colorized.find('<span'):] | 75 colorized = colorized[colorized.find('<span'):] |
76 coloriter = (l for l in colorized.splitlines()) | 76 coloriter = iter(colorized.splitlines()) |
77 | 77 |
78 filters['colorize'] = lambda x: coloriter.next() | 78 filters['colorize'] = lambda x: coloriter.next() |
79 | 79 |
80 oldl = tmpl.cache[field] | 80 oldl = tmpl.cache[field] |
81 newl = oldl.replace('line|escape', 'line|colorize') | 81 newl = oldl.replace('line|escape', 'line|colorize') |