mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Removes leading 'b' on slugs in Python 3
This commit is contained in:
parent
9950cfecbb
commit
725257ca3d
1 changed files with 2 additions and 0 deletions
|
@ -146,6 +146,8 @@ def slugify(string):
|
||||||
"""
|
"""
|
||||||
string = u(string)
|
string = u(string)
|
||||||
ascii_string = str(unicodedata.normalize('NFKD', string).encode('ascii', 'ignore'))
|
ascii_string = str(unicodedata.normalize('NFKD', string).encode('ascii', 'ignore'))
|
||||||
|
if PY3:
|
||||||
|
ascii_string = ascii_string[1:] # removed the leading 'b'
|
||||||
no_punctuation = re.sub(r'[^\w\s-]', '', ascii_string).strip().lower()
|
no_punctuation = re.sub(r'[^\w\s-]', '', ascii_string).strip().lower()
|
||||||
slug = re.sub(r'[-\s]+', '-', no_punctuation)
|
slug = re.sub(r'[-\s]+', '-', no_punctuation)
|
||||||
return u(slug)
|
return u(slug)
|
||||||
|
|
Loading…
Add table
Reference in a new issue