diff --git a/pylons_app/lib/helpers.py b/pylons_app/lib/helpers.py --- a/pylons_app/lib/helpers.py +++ b/pylons_app/lib/helpers.py @@ -213,14 +213,23 @@ class _FilesBreadCrumbs(object): return literal('/'.join(url_l)) files_breadcrumbs = _FilesBreadCrumbs() +class CodeHtmlFormatter(HtmlFormatter): + def wrap(self, source, outfile): + return self._wrap_div(self._wrap_pre(self._wrap_code(source))) + + def _wrap_code(self, source): + for cnt, it in enumerate(source, 1): + i, t = it + t = '
%s
' % (cnt, t) + yield i, t def pygmentize(filenode, **kwargs): """ pygmentize function using pygments @param filenode: """ return literal(code_highlight(filenode.content, - filenode.lexer, HtmlFormatter(**kwargs))) + filenode.lexer, CodeHtmlFormatter(**kwargs))) def pygmentize_annotation(filenode, **kwargs): """ diff --git a/pylons_app/public/css/pygments.css b/pylons_app/public/css/pygments.css --- a/pylons_app/public/css/pygments.css +++ b/pylons_app/public/css/pygments.css @@ -22,10 +22,13 @@ div.codeblock .code-header .commit{ margin-left:25px; font-weight: normal; } + div.codeblock .code-body table{ width: 0 !important; } - +div.code-body { + background-color: #FFFFFF; +} div.code-body pre .match{ background-color: #FAFFA6; } @@ -36,13 +39,10 @@ div.code-body pre .break{ display: block; } - div.annotatediv{ margin-left:2px; margin-right:4px; } - - .code-highlight { padding: 0px; margin-top: 5px; @@ -55,7 +55,6 @@ div.annotatediv{ } .linenos a { text-decoration: none; } - .code { display: block; } .code-highlight .hll { background-color: #ffffcc } .code-highlight .c { color: #408080; font-style: italic } /* Comment */