summaryrefslogtreecommitdiff
path: root/sphinx/writers/html.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-12-11 09:25:59 +0100
committerGeorg Brandl <georg@python.org>2010-12-11 09:25:59 +0100
commitbfc9d6f2ddd7e5143e1fefe12f84c50cf4c4fdd5 (patch)
treecac70d3a5585090af8c1d7c67f401c285d0b5005 /sphinx/writers/html.py
parent274f18f8df1cc5e3c4c88aeaba36bfc691487d0a (diff)
downloadsphinx-bfc9d6f2ddd7e5143e1fefe12f84c50cf4c4fdd5.tar.gz
Remove html_permalink_text again and give meaning to html_add_permalinks.
Diffstat (limited to 'sphinx/writers/html.py')
-rw-r--r--sphinx/writers/html.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py
index 28d61a43..1cc3bbe5 100644
--- a/sphinx/writers/html.py
+++ b/sphinx/writers/html.py
@@ -59,8 +59,11 @@ class HTMLTranslator(BaseTranslator):
self.highlightlang = builder.config.highlight_language
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.permalink_text = builder.config.html_add_permalinks
+ # support backwards-compatible setting to a bool
+ if not isinstance(self.permalink_text, basestring):
+ self.permalink_text = self.permalink_text and u'\u00B6' or ''
+ self.permalink_text = self.encode(self.permalink_text)
self.secnumber_suffix = builder.config.html_secnumber_suffix
def visit_start_of_file(self, node):
@@ -82,13 +85,12 @@ class HTMLTranslator(BaseTranslator):
and node['ids'] and node['first']:
self.body.append('<!--[%s]-->' % node['ids'][0])
def depart_desc_signature(self, node):
- if node['ids'] and self.add_permalinks and self.builder.add_permalinks:
+ if node['ids'] and self.permalink_text and self.builder.add_permalinks:
self.body.append(u'<a class="headerlink" href="#%s" '
% node['ids'][0] +
u'title="%s">%s</a>' % (
_('Permalink to this definition'),
- self.permalink_text)
- )
+ self.permalink_text))
self.body.append('</dt>\n')
def visit_desc_addname(self, node):
@@ -483,7 +485,7 @@ class HTMLTranslator(BaseTranslator):
def depart_title(self, node):
close_tag = self.context[-1]
- if (self.add_permalinks and self.builder.add_permalinks and
+ if (self.permalink_text and self.builder.add_permalinks and
node.parent.hasattr('ids') and node.parent['ids']):
aname = node.parent['ids'][0]
# add permalink anchor