Ticket #9645: t9645-r9523.diff

File t9645-r9523.diff, 1.2 KB (added by Ramiro Morales, 16 years ago)
  • docs/_ext/djangodocs.py

    diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py
    a b  
    130130   
    131131    # Give each section a unique ID -- nice for custom CSS hooks
    132132    # This is different on docutils 0.5 vs. 0.4...
    133    
    134     # The docutils 0.4 override.
    135     if hasattr(sphinx.htmlwriter.SmartyPantsHTMLTranslator, 'start_tag_with_title'):
     133
     134    if hasattr(sphinx.htmlwriter.SmartyPantsHTMLTranslator, 'start_tag_with_title') and sphinx.__version__ == '0.4.2':
    136135        def start_tag_with_title(self, node, tagname, **atts):
    137136            node = {
    138137                'classes': node.get('classes', []),
    139138                'ids': ['s-%s' % i for i in node.get('ids', [])]
    140139            }
    141140            return self.starttag(node, tagname, **atts)
    142            
    143     # The docutils 0.5 override.
    144     else:       
     141
     142    else:
    145143        def visit_section(self, node):
    146144            old_ids = node.get('ids', [])
    147145            node['ids'] = ['s-' + i for i in old_ids]
     146            if sphinx.__version__ != '0.4.2':
     147                node['ids'].extend(old_ids)
    148148            sphinx.htmlwriter.SmartyPantsHTMLTranslator.visit_section(self, node)
    149149            node['ids'] = old_ids
    150150
Back to Top