aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Shachnev <mitya57@gmail.com>2013-09-29 19:20:59 +0400
committerDmitry Shachnev <mitya57@gmail.com>2013-09-29 19:21:10 +0400
commit635d2f71db191145d30cba4934ab7fa8f4d20509 (patch)
treeb42f96cbb995067e6552858c3906198405e4e86f
parent6efe75869ac7ab60ccadc0a9c4ac64f9a7722379 (diff)
downloadmarkdown-635d2f71db191145d30cba4934ab7fa8f4d20509.tar.gz
markdown-635d2f71db191145d30cba4934ab7fa8f4d20509.tar.bz2
markdown-635d2f71db191145d30cba4934ab7fa8f4d20509.zip
toc: insert `&para;` instead of raw unicode character
-rw-r--r--markdown/extensions/toc.py6
-rw-r--r--tests/extensions/toc_nested.html8
2 files changed, 7 insertions, 7 deletions
diff --git a/markdown/extensions/toc.py b/markdown/extensions/toc.py
index eba0e69..89468d6 100644
--- a/markdown/extensions/toc.py
+++ b/markdown/extensions/toc.py
@@ -13,7 +13,7 @@ from __future__ import absolute_import
from __future__ import unicode_literals
from . import Extension
from ..treeprocessors import Treeprocessor
-from ..util import etree, parseBoolValue
+from ..util import etree, parseBoolValue, AMP_SUBSTITUTE
from .headerid import slugify, unique, itertext, stashedHTML2text
import re
@@ -101,8 +101,8 @@ class TocTreeprocessor(Treeprocessor):
def add_permalink(self, c, elem_id):
permalink = etree.Element("a")
- permalink.text = ("\xb6" if self.use_permalinks is True
- else self.use_permalinks)
+ permalink.text = ("%spara;" % AMP_SUBSTITUTE
+ if self.use_permalinks is True else self.use_permalinks)
permalink.attrib["href"] = "#" + elem_id
permalink.attrib["class"] = "headerlink"
permalink.attrib["title"] = "Permanent link"
diff --git a/tests/extensions/toc_nested.html b/tests/extensions/toc_nested.html
index b913640..27af9df 100644
--- a/tests/extensions/toc_nested.html
+++ b/tests/extensions/toc_nested.html
@@ -1,7 +1,7 @@
-<h1 id="header-a">Header A<a class="headerlink" href="#header-a" title="Permanent link">¶</a></h1>
-<h2 id="header-1">Header 1<a class="headerlink" href="#header-1" title="Permanent link">¶</a></h2>
-<h3 id="header-i">Header i<a class="headerlink" href="#header-i" title="Permanent link">¶</a></h3>
-<h1 id="header-b">Header <em>B</em><a class="headerlink" href="#header-b" title="Permanent link">¶</a></h1>
+<h1 id="header-a">Header A<a class="headerlink" href="#header-a" title="Permanent link">&para;</a></h1>
+<h2 id="header-1">Header 1<a class="headerlink" href="#header-1" title="Permanent link">&para;</a></h2>
+<h3 id="header-i">Header i<a class="headerlink" href="#header-i" title="Permanent link">&para;</a></h3>
+<h1 id="header-b">Header <em>B</em><a class="headerlink" href="#header-b" title="Permanent link">&para;</a></h1>
<div class="toc">
<ul>
<li><a href="#header-a">Header A</a><ul>