Commits

Anonymous committed 71994f1

Add header links statically.

  • Participants
  • Parent commits cb8cbb9

Comments (0)

Files changed (2)

File sphinx/style/doctools.js

 var Documentation = {
 
   init : function() {
-    this.addContextElements();
+    /* this.addContextElements(); -- now done statically */
     this.fixFirefoxAnchorBug();
     this.highlightSearchWords();
     this.initModIndex();

File sphinx/writer.py

         if node.parent['desctype'] in ('class', 'exception'):
             self.body.append('%s ' % node.parent['desctype'])
     def depart_desc_signature(self, node):
+        if node['ids']:
+            self.body.append(u'<a class="headerlink" href="#%s" ' % node['ids'][0] +
+                             u'title="Permalink to this definition">\u00B6</a>')
         self.body.append('</dt>\n')
 
     def visit_desc_classname(self, node):
     def depart_literal_emphasis(self, node):
         return self.depart_emphasis(node)
 
+    def depart_title(self, node):
+        close_tag = self.context[-1]
+        if close_tag.startswith(('</h', '</a></h')) and \
+               node.parent.hasattr('ids') and node.parent['ids']:
+            aname = node.parent['ids'][0]
+            # add permalink anchor
+            self.body.append(u'<a class="headerlink" href="#%s" ' % aname +
+                             u'title="Permalink to this headline">\u00B6</a>')
+        BaseTranslator.depart_title(self, node)
+
 
 class SmartyPantsHTMLTranslator(HTMLTranslator):
     """