fix pygments disaligned linenos and code when using windows fonts (pygments>0.7 only)
Tue Aug 12 09:50:07 UTC 2008 Alexandre Rossi <alexandre.rossi@gmail.com>
* fix pygments disaligned linenos and code when using windows fonts (pygments>0.7 only)
diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi
--- old-darcsweb/darcsweb.cgi 2013-07-18 20:21:03.000000000 +0000
+++ new-darcsweb/darcsweb.cgi 2013-07-18 20:21:03.000000000 +0000
@@ -1324,8 +1324,15 @@
else:
lexer = pygments.lexers.guess_lexer_for_filename(fname, code[:200],
encoding=config.repoencoding[0])
- formatter = pygments.formatters.HtmlFormatter(linenos=True,
+
+ pygments_version = map(int, pygments.__version__.split('.'))
+ if pygments_version >= [0, 7]:
+ linenos_method = 'inline'
+ else:
+ linenos_method = True
+ formatter = pygments.formatters.HtmlFormatter(linenos=linenos_method,
cssclass='page_body')
+
print pygments.highlight(code, lexer, formatter)
def print_annotate(ann, style):