highlight: make div trimmer work when lexer fails to identify text.
authorBrendan Cully <brendan@kublai.com>
Fri, 29 Feb 2008 14:21:15 -0800
changeset 6197 f6565f7d9489
parent 6196 fc9535ae6fe2
child 6198 358cc9cf54db
highlight: make div trimmer work when lexer fails to identify text. In this case, there is no initial <span> tag.
hgext/highlight.py
--- a/hgext/highlight.py	Fri Feb 29 11:13:50 2008 -0800
+++ b/hgext/highlight.py	Fri Feb 29 14:21:15 2008 -0800
@@ -72,7 +72,7 @@
     colorized = highlight(text, lexer, formatter)
     # strip wrapping div
     colorized = colorized[:colorized.find('\n</pre>')]
-    colorized = colorized[colorized.find('<span'):]
+    colorized = colorized[colorized.find('<pre>')+5:]
     coloriter = iter(colorized.splitlines())
 
     filters['colorize'] = lambda x: coloriter.next()