merge with trunk

This commit is contained in:
Georg Brandl 2009-02-15 10:46:17 +01:00
commit 016f375403
2 changed files with 15 additions and 3 deletions

View File

@ -43,7 +43,7 @@ included, please mail to `the Google group
* PyPubSub: http://pubsub.sourceforge.net/
* pyrticle: http://documen.tician.de/pyrticle/
* Pysparse: http://pysparse.sourceforge.net/
* Python: http://docs.python.org/dev/
* Python: http://docs.python.org/
* python-apt: http://people.debian.org/~jak/python-apt-doc/
* PyUblas: http://documen.tician.de/pyublas/
* Reteisi: http://docs.argolinux.org/reteisi/

View File

@ -134,6 +134,19 @@ class HandleCodeBlocks(Transform):
nodes.doctest_block):
node.replace_self(node.children[0])
class SortIds(Transform):
"""
Sort secion IDs so that the "id[0-9]+" one comes last.
"""
default_priority = 261
def apply(self):
for node in self.document.traverse(nodes.section):
if len(node['ids']) > 1 and node['ids'][0].startswith('id'):
node['ids'] = node['ids'][1:] + [node['ids'][0]]
class CitationReferences(Transform):
"""
Handle citation references before the default docutils transform does.
@ -154,7 +167,7 @@ class SphinxStandaloneReader(standalone.Reader):
Add our own transforms.
"""
transforms = [CitationReferences, DefaultSubstitutions, MoveModuleTargets,
HandleCodeBlocks]
HandleCodeBlocks, SortIds]
def get_transforms(self):
return standalone.Reader.get_transforms(self) + self.transforms
@ -167,7 +180,6 @@ class SphinxDummyWriter(UnfilteredWriter):
pass
class SphinxContentsFilter(ContentsFilter):
"""
Used with BuildEnvironment.add_toc_from() to discard cross-file links