misc: don't fold apostrophes in slugs (#7108)
This commit is contained in:
parent
74c2beddae
commit
d4bff9858c
|
@ -65,6 +65,10 @@ def test_simplify_space():
|
|||
assert simplify('test again', '_') == 'test_again'
|
||||
assert simplify(' test again ', '_') == 'test_again'
|
||||
|
||||
def test_simplify_apostrophes():
|
||||
assert simplify('test\'again') == 'test-again'
|
||||
assert simplify('test\'\'\'again') == 'test-again'
|
||||
|
||||
def test_simplify_accented():
|
||||
assert simplify(u'cliché') == 'cliche'
|
||||
assert simplify(u'cliché'.encode('iso-8859-1')) == 'cliche'
|
||||
|
|
|
@ -139,8 +139,8 @@ def simplify(s, space='-'):
|
|||
else:
|
||||
s = unicode(s, 'iso-8859-1', 'ignore')
|
||||
s = unicodedata.normalize('NFKD', s).encode('ascii', 'ignore')
|
||||
s = re.sub('[^\w\s%s]' % space, '', s).strip().lower()
|
||||
s = re.sub('[\s%s]+' % space, space, s)
|
||||
s = re.sub(r'[^\w\s\'%s]' % space, '', s).strip().lower()
|
||||
s = re.sub(r'[\s\'%s]+' % space, space, s)
|
||||
return s
|
||||
|
||||
def get_datetime_language():
|
||||
|
|
Loading…
Reference in New Issue