From 635d2f71db191145d30cba4934ab7fa8f4d20509 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Sun, 29 Sep 2013 19:20:59 +0400 Subject: toc: insert `¶` instead of raw unicode character --- markdown/extensions/toc.py | 6 +++--- tests/extensions/toc_nested.html | 8 ++++---- 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 @@ -

Header A

-

Header 1

-

Header i

-

Header B

+

Header A

+

Header 1

+

Header i

+

Header B