From dbd6676ca554fb12aa82510a67f5e89ec6ada91c Mon Sep 17 00:00:00 2001 From: Erik van Zijst Date: Tue, 14 Aug 2012 16:16:24 -0700 Subject: Fixed unicode breakage. slugify() requires unicode, not a str instance. This causes the extension to crash: File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/__init__.py" in markdown 386. return md.convert(text) File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/__init__.py" in convert 287. newRoot = treeprocessor.run(root) File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/extensions/headerid.py" in run 140. id = slugify(''.join(itertext(elem)), sep) File "/home/erik/virtualenv/bb/local/lib/python2.7/site-packages/markdown/extensions/headerid.py" in slugify 93. value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore') TypeError: must be unicode, not str --- markdown/extensions/headerid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdown/extensions/headerid.py b/markdown/extensions/headerid.py index 3f9e4c4..e86ab15 100644 --- a/markdown/extensions/headerid.py +++ b/markdown/extensions/headerid.py @@ -137,7 +137,7 @@ class HeaderIdTreeprocessor(markdown.treeprocessors.Treeprocessor): if "id" in elem.attrib: id = elem.id else: - id = slugify(''.join(itertext(elem)), sep) + id = slugify(u''.join(itertext(elem)), sep) elem.set('id', unique(id, self.IDs)) if start_level: level = int(elem.tag[-1]) + start_level -- cgit v1.2.3