[Python-checkins] r66356 - in doctools/trunk: sphinx/htmlwriter.py

georg.brandl python-checkins at python.org
Wed Sep 10 00:08:43 CEST 2008


Author: georg.brandl
Date: Wed Sep 10 00:08:42 2008
New Revision: 66356
Log:
Merged revisions 66355 via svnmerge from 
svn+ssh://pythondev@svn.python.org/doctools/branches/0.4.x
........
 r66355 | georg.brandl | 2008年09月10日 00:06:51 +0200 (2008年9月10日) | 2 lines
 
 #3746: fix duplicate id generation with docutils 0.5.
........
Modified:
 doctools/trunk/ (props changed)
 doctools/trunk/sphinx/htmlwriter.py
Modified: doctools/trunk/sphinx/htmlwriter.py
==============================================================================
--- doctools/trunk/sphinx/htmlwriter.py	(original)
+++ doctools/trunk/sphinx/htmlwriter.py	Wed Sep 10 00:08:42 2008
@@ -164,20 +164,16 @@
 def depart_seealso(self, node):
 self.depart_admonition(node)
 
- # overwritten (args/kwds due to docutils 0.4/0.5 incompatibility)
- def visit_title(self, node, *args, **kwds):
- # if we have a section we do our own processing in order
- # to have ids in the hN-tags and not in additional a-tags
- if isinstance(node.parent, nodes.section):
- h_level = self.section_level + self.initial_header_level - 1
- if node.parent.get('ids'):
- attrs = {'ids': node.parent['ids']}
- else:
- attrs = {}
- self.body.append(self.starttag(node, 'h%d' % h_level, '', **attrs))
- self.context.append('</h%d>\n' % h_level)
- else:
- BaseTranslator.visit_title(self, node, *args, **kwds)
+ # overwritten for docutils 0.4
+ if hasattr(BaseTranslator, 'start_tag_with_title'):
+ def visit_section(self, node):
+ # the 0.5 version, to get the id attribute in the <div> tag
+ self.section_level += 1
+ self.body.append(self.starttag(node, 'div', CLASS='section'))
+
+ def visit_title(self, node):
+ # don't move the id attribute inside the <h> tag
+ BaseTranslator.visit_title(self, node, move_ids=0)
 
 # overwritten
 def visit_literal_block(self, node):


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /