Mercurial > public > src > rhodecode
changeset 550:5aba7adff196
little gui change for file source
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 25 Sep 2010 23:36:10 +0200 |
parents | d280aa1c85c6 |
children | d5efb83590ef |
files | pylons_app/lib/helpers.py pylons_app/public/css/pygments.css |
diffstat | 2 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 = '<div id="#S-%s">%s</div>' % (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): """
--- 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 */