[Python-checkins] r67038 - in doctools/trunk: CHANGES sphinx/htmlwriter.py
georg.brandl
python-checkins at python.org
Tue Oct 28 09:39:31 CET 2008
Author: georg.brandl
Date: Tue Oct 28 09:39:31 2008
New Revision: 67038
Log:
Don't throw away labels for code blocks.
Modified:
doctools/trunk/CHANGES
doctools/trunk/sphinx/htmlwriter.py
Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES (original)
+++ doctools/trunk/CHANGES Tue Oct 28 09:39:31 2008
@@ -145,6 +145,8 @@
* 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)
===========================
Modified: doctools/trunk/sphinx/htmlwriter.py
==============================================================================
--- doctools/trunk/sphinx/htmlwriter.py (original)
+++ doctools/trunk/sphinx/htmlwriter.py Tue Oct 28 09:39:31 2008
@@ -193,8 +193,10 @@
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 @@
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.
More information about the Python-checkins
mailing list