fix a bug in get_sort_title with articles that end with a single quote
This commit is contained in:
parent
8b756b888a
commit
c5a6b36273
1 changed files with 6 additions and 2 deletions
|
@ -108,11 +108,15 @@ def get_sort_title(title):
|
||||||
>>> get_sort_title('Die Hard')
|
>>> get_sort_title('Die Hard')
|
||||||
'Hard, Die'
|
'Hard, Die'
|
||||||
|
|
||||||
|
>>> get_sort_title("L'atalante")
|
||||||
|
"atalante, L'"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
for article in ARTICLES:
|
for article in ARTICLES:
|
||||||
if title.lower().startswith(article + ' '):
|
spaces = 0 if article.endswith("'") else 1
|
||||||
|
if title.lower().startswith(article + ' ' * spaces):
|
||||||
length = len(article)
|
length = len(article)
|
||||||
return title[length + 1:] + ', ' + title[:length]
|
return title[length + spaces:] + ', ' + title[:length]
|
||||||
return title
|
return title
|
||||||
|
|
||||||
def findRe(string, regexp):
|
def findRe(string, regexp):
|
||||||
|
|
Loading…
Reference in a new issue