From 650ed71a4d46788a5560c57b6c096fbdc54cb935 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 15 Feb 2009 02:30:12 +0100 Subject: [PATCH 1/2] Update Python docs URL. --- EXAMPLES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXAMPLES b/EXAMPLES index dec3c3ef1..87c69173e 100644 --- a/EXAMPLES +++ b/EXAMPLES @@ -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/ From 56b204b8a41e4a9d8d7447037f47cb541dc328b9 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 15 Feb 2009 02:49:08 +0100 Subject: [PATCH 2/2] Use well-named IDs before auto-named IDs. --- sphinx/environment.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sphinx/environment.py b/sphinx/environment.py index de04b0f81..2e6c68176 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -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