summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-11-09 20:21:42 +0100
committerGeorg Brandl <georg@python.org>2008-11-09 20:21:42 +0100
commitd0d960d5f8c719b4e8a1694174e7b4d0e147474c (patch)
treed8701fac920fece5dc877226ce14be440fa380bb
parent99f5c988480c2007f3d01a6105902486c1fe56a9 (diff)
downloadsphinx-d0d960d5f8c719b4e8a1694174e7b4d0e147474c.tar.gz
Give highlighted text a class "highlight-<lang>".
-rw-r--r--sphinx/htmlwriter.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/sphinx/htmlwriter.py b/sphinx/htmlwriter.py
index dd56b409..0505fd08 100644
--- a/sphinx/htmlwriter.py
+++ b/sphinx/htmlwriter.py
@@ -194,11 +194,8 @@ class HTMLTranslator(BaseTranslator):
if node.has_key('linenos'):
linenos = node['linenos']
highlighted = self.highlighter.highlight_block(node.rawsource, lang, linenos)
- starttag = self.starttag(node, 'div', suffix='')
- if starttag != '<div>':
- self.body.append(starttag + highlighted + '</div>\n')
- else:
- self.body.append(highlighted)
+ starttag = self.starttag(node, 'div', suffix='', CLASS='highlight-%s' % lang)
+ self.body.append(starttag + highlighted + '</div>\n')
raise nodes.SkipNode
def visit_doctest_block(self, node):