# HG changeset patch # User Marcin Kuzminski # Date 1285450570 -7200 # Node ID 5aba7adff1960ab81bec2b62dc673b00ab2255ca # Parent d280aa1c85c626f25d4b089a3791f1a0d313b02a little gui change for file source diff -r d280aa1c85c6 -r 5aba7adff196 pylons_app/lib/helpers.py --- a/pylons_app/lib/helpers.py Sat Sep 25 20:17:56 2010 +0200 +++ b/pylons_app/lib/helpers.py Sat Sep 25 23:36:10 2010 +0200 @@ -213,14 +213,23 @@ 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 -r d280aa1c85c6 -r 5aba7adff196 pylons_app/public/css/pygments.css --- a/pylons_app/public/css/pygments.css Sat Sep 25 20:17:56 2010 +0200 +++ b/pylons_app/public/css/pygments.css Sat Sep 25 23:36:10 2010 +0200 @@ -22,10 +22,13 @@ 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 @@ display: block; } - div.annotatediv{ margin-left:2px; margin-right:4px; } - - .code-highlight { padding: 0px; margin-top: 5px; @@ -55,7 +55,6 @@ } .linenos a { text-decoration: none; } - .code { display: block; } .code-highlight .hll { background-color: #ffffcc } .code-highlight .c { color: #408080; font-style: italic } /* Comment */