aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2011-07-28 13:13:17 -0400
committerWaylan Limberg <waylan@gmail.com>2011-07-28 13:13:17 -0400
commitefa3e93ea7f222bc122866ad423053d540382c76 (patch)
treef00d1b0337d0af46e4dc1b8e2d1b394a87ee2da6
parenta636c4ff19b278801425aaf16a0db1d055be0fd7 (diff)
downloadmarkdown-efa3e93ea7f222bc122866ad423053d540382c76.tar.gz
markdown-efa3e93ea7f222bc122866ad423053d540382c76.tar.bz2
markdown-efa3e93ea7f222bc122866ad423053d540382c76.zip
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.
-rw-r--r--markdown/extensions/headerid.py2
1 files changed, 1 insertions, 1 deletions
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)