summaryrefslogtreecommitdiff
path: root/docs/_ext/djangodocs.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-12-07 04:00:08 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-12-07 04:00:08 +0000
commite8707e068d5e4374204b813ca26bd4150eef7023 (patch)
tree10f89ee13296026ac4d0355f7071acefde1e4dfe /docs/_ext/djangodocs.py
parentd1102d63e67ba62577f1ddf6fd65ac5f927872e6 (diff)
downloaddjango-e8707e068d5e4374204b813ca26bd4150eef7023.tar.gz
Fixed #9645 -- Work around a backwards-incompatibility in Sphinx so that
various combinations of released docutils and sphinx versions all work together. Thanks, Ramiro Morales. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9586 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/_ext/djangodocs.py')
-rw-r--r--docs/_ext/djangodocs.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py
index 5640016502..bda7d3e4ce 100644
--- a/docs/_ext/djangodocs.py
+++ b/docs/_ext/djangodocs.py
@@ -130,21 +130,21 @@ class DjangoHTMLTranslator(sphinx.htmlwriter.SmartyPantsHTMLTranslator):
# Give each section a unique ID -- nice for custom CSS hooks
# This is different on docutils 0.5 vs. 0.4...
-
- # The docutils 0.4 override.
- if hasattr(sphinx.htmlwriter.SmartyPantsHTMLTranslator, 'start_tag_with_title'):
+
+ if hasattr(sphinx.htmlwriter.SmartyPantsHTMLTranslator, 'start_tag_with_title') and sphinx.__version__ == '0.4.2':
def start_tag_with_title(self, node, tagname, **atts):
node = {
'classes': node.get('classes', []),
'ids': ['s-%s' % i for i in node.get('ids', [])]
}
return self.starttag(node, tagname, **atts)
-
- # The docutils 0.5 override.
- else:
+
+ else:
def visit_section(self, node):
old_ids = node.get('ids', [])
node['ids'] = ['s-' + i for i in old_ids]
+ if sphinx.__version__ != '0.4.2':
+ node['ids'].extend(old_ids)
sphinx.htmlwriter.SmartyPantsHTMLTranslator.visit_section(self, node)
node['ids'] = old_ids