Anonymous avatar Anonymous committed 2fd3302

#559 Add `html_permalink_text` confval

Comments (0)

Files changed (4)

 
 * #526: Added Iranian translation.
 
+* #559: Added :confval:`html_permalink_text`.
+
 
 Release 1.0.6 (in development)
 ==============================
    .. versionadded:: 0.6
       Previously, this was always activated.
 
+.. confval:: html_permalink_text
+
+   A string specifying the text which should be used for "permalinks".
+   Default: ``u'\u00B6'``.
+
+   .. versionadded:: 1.1
+      Previously, this was always the current default value.
+
 .. confval:: html_sidebars
 
    Custom sidebar templates, must be a dictionary that maps document names to
         html_use_modindex = (True, 'html'),  # deprecated
         html_domain_indices = (True, 'html'),
         html_add_permalinks = (True, 'html'),
+        html_permalink_text = (u'\u00B6', 'html'),
         html_use_index = (True, 'html'),
         html_split_index = (False, 'html'),
         html_copy_source = (True, 'html'),

sphinx/writers/html.py

         self.highlightlinenothreshold = sys.maxint
         self.protect_literal_text = 0
         self.add_permalinks = builder.config.html_add_permalinks
+        self.permalink_text = builder.config.html_permalink_text
         self.secnumber_suffix = builder.config.html_secnumber_suffix
 
     def visit_start_of_file(self, node):
         if node['ids'] and self.add_permalinks and self.builder.add_permalinks:
             self.body.append(u'<a class="headerlink" href="#%s" '
                              % node['ids'][0] +
-                             u'title="%s">\u00B6</a>' %
-                             _('Permalink to this definition'))
+                             u'title="%s">%s</a>' % (
+                             _('Permalink to this definition'),
+                             self.permalink_text)
+                             )
         self.body.append('</dt>\n')
 
     def visit_desc_addname(self, node):
             # add permalink anchor
             if close_tag.startswith('</h'):
                 self.body.append(u'<a class="headerlink" href="#%s" ' % aname +
-                                 u'title="%s">\u00B6</a>' %
-                                 _('Permalink to this headline'))
+                                 u'title="%s">%s</a>' % (
+                                 _('Permalink to this headline'),
+                                 self.permalink_text))
             elif close_tag.startswith('</a></h'):
                 self.body.append(u'</a><a class="headerlink" href="#%s" ' %
                                  aname +
-                                 u'title="%s">\u00B6' %
-                                 _('Permalink to this headline'))
+                                 u'title="%s">%s' % (
+                                 _('Permalink to this headline'),
+                                 self.permalink_text))
 
         BaseTranslator.depart_title(self, node)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.