1. Georg Brandl
  2. sphinx

Commits

georg.brandl  committed d5b5ec2

Don't throw away labels for code blocks.

  • Participants
  • Parent commits 62f7837
  • Branches default

Comments (0)

Files changed (2)

File CHANGES

View file
  • Ignore whitespace
 
 * Don't disregard return annotations for functions without any parameters.
 
+* Don't throw away labels for code blocks.
+
 
 Release 0.4.3 (Oct 8, 2008)
 ===========================

File sphinx/htmlwriter.py

View file
  • Ignore whitespace
             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):
         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.