diff options
author | Daniel Neuhäuser <ich@danielneuhaeuser.de> | 2010-12-01 22:54:54 +0100 |
---|---|---|
committer | Daniel Neuhäuser <ich@danielneuhaeuser.de> | 2010-12-01 22:54:54 +0100 |
commit | dd955b1f94d404fd45a343de322f3f1175dcb26b (patch) | |
tree | 8104c868ab4ae64556c67a5727b5abf067cc86cd | |
parent | 8dc49de95641a85e99b4e0e8d2467618f41cad49 (diff) | |
download | sphinx-git-dd955b1f94d404fd45a343de322f3f1175dcb26b.tar.gz |
#559 Add `html_permalink_text` confval
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | doc/config.rst | 8 | ||||
-rw-r--r-- | sphinx/config.py | 1 | ||||
-rw-r--r-- | sphinx/writers/html.py | 17 |
4 files changed, 22 insertions, 6 deletions
@@ -25,6 +25,8 @@ Release 1.1 (in development) * #526: Added Iranian translation. +* #559: Added :confval:`html_permalink_text`. + Release 1.0.6 (in development) ============================== diff --git a/doc/config.rst b/doc/config.rst index 90730d60c..503a357c7 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -506,6 +506,14 @@ that use Sphinx' HTMLWriter class. .. 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 diff --git a/sphinx/config.py b/sphinx/config.py index 6f957314a..abde73cea 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -93,6 +93,7 @@ class Config(object): 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'), diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py index be4a97c5d..28d61a436 100644 --- a/sphinx/writers/html.py +++ b/sphinx/writers/html.py @@ -60,6 +60,7 @@ class HTMLTranslator(BaseTranslator): 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): @@ -84,8 +85,10 @@ class HTMLTranslator(BaseTranslator): 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): @@ -486,13 +489,15 @@ class HTMLTranslator(BaseTranslator): # 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) |