highlight: fix page layout with empty first and last lines
Repeated newlines were stripped by pygmentize, now give the option not to do so.
--- a/hgext/highlight/highlight.py Thu May 09 15:17:29 2013 -0500
+++ b/hgext/highlight/highlight.py Fri May 10 00:26:39 2013 +0400
@@ -38,12 +38,13 @@
# To get multi-line strings right, we can't format line-by-line
try:
- lexer = guess_lexer_for_filename(fctx.path(), text[:1024])
+ lexer = guess_lexer_for_filename(fctx.path(), text[:1024],
+ stripnl=False)
except (ClassNotFound, ValueError):
try:
- lexer = guess_lexer(text[:1024])
+ lexer = guess_lexer(text[:1024], stripnl=False)
except (ClassNotFound, ValueError):
- lexer = TextLexer()
+ lexer = TextLexer(stripnl=False)
formatter = HtmlFormatter(style=style)