From efa3e93ea7f222bc122866ad423053d540382c76 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Thu, 28 Jul 2011 13:13:17 -0400 Subject: Fix a minor Python 3 incompatability in the headerid extension's slugify function. The url is being encoded (with errors ignored) as an easy means of removing non-ascii chars, but we have to re-encode it *before* running the regex on it, not after. --- 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 e967648..42e82b0 100644 --- a/markdown/extensions/headerid.py +++ b/markdown/extensions/headerid.py @@ -87,7 +87,7 @@ IDCOUNT_RE = re.compile(r'^(.*)_([0-9]+)$') def slugify(value, separator): """ Slugify a string, to make it URL friendly. """ value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore') - value = unicode(re.sub('[^\w\s-]', '', value).strip().lower()) + value = re.sub('[^\w\s-]', '', value.decode('ascii')).strip().lower() return re.sub('[%s\s]+' % separator, separator, value) -- cgit v1.2.3