summaryrefslogtreecommitdiff
path: root/sphinx/htmlwriter.py
diff options
context:
space:
mode:
authorgeorg.brandl <devnull@localhost>2008-10-28 08:39:31 +0000
committergeorg.brandl <devnull@localhost>2008-10-28 08:39:31 +0000
commita4c8d0a3efeeabec815d06ef8dc17a53f261759e (patch)
tree02098b3e9fea8e416b33b2b310efbbdffdca55dd /sphinx/htmlwriter.py
parent52f801fbafa54367450a261d2845f1626a8b1042 (diff)
downloadsphinx-a4c8d0a3efeeabec815d06ef8dc17a53f261759e.tar.gz
Don't throw away labels for code blocks.
Diffstat (limited to 'sphinx/htmlwriter.py')
-rw-r--r--sphinx/htmlwriter.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/sphinx/htmlwriter.py b/sphinx/htmlwriter.py
index b1606437..b4d700cc 100644
--- a/sphinx/htmlwriter.py
+++ b/sphinx/htmlwriter.py
@@ -193,8 +193,10 @@ class HTMLTranslator(BaseTranslator):
lang = node['language']
if node.has_key('linenos'):
linenos = node['linenos']
- self.body.append(self.highlighter.highlight_block(node.rawsource,
- lang, linenos))
+ highlighted = self.highlighter.highlight_block(node.rawsource, lang, linenos)
+ starttag = self.starttag(node, 'div', suffix='')[:-1]
+ self.body.append(starttag + highlighted[4:]) # skip '<div' and replace by
+ # one possibly containing id attr
raise nodes.SkipNode
def visit_doctest_block(self, node):
@@ -259,12 +261,12 @@ class HTMLTranslator(BaseTranslator):
if olduri in self.builder.images:
node['uri'] = posixpath.join(self.builder.imgpath,
self.builder.images[olduri])
-
+
if node.has_key('scale'):
if Image and not (node.has_key('width')
and node.has_key('height')):
try:
- im = Image.open(os.path.join(self.builder.srcdir,
+ im = Image.open(os.path.join(self.builder.srcdir,
olduri))
except (IOError, # Source image can't be found or opened
UnicodeError): # PIL doesn't like Unicode paths.