Fix #6594 (Title sort should ignore the leading quote character)

This commit is contained in:
Kovid Goyal 2010-08-24 12:32:01 -06:00
parent d8be901fc4
commit 1a295d31cf

View File

@ -46,8 +46,11 @@ def authors_to_sort_string(authors):
return ' & '.join(map(author_to_author_sort, authors)) return ' & '.join(map(author_to_author_sort, authors))
_title_pat = re.compile('^(A|The|An)\s+', re.IGNORECASE) _title_pat = re.compile('^(A|The|An)\s+', re.IGNORECASE)
_ignore_starts = u'\'"'+u''.join(unichr(x) for x in range(0x2018, 0x201e)+[0x2032, 0x2033])
def title_sort(title): def title_sort(title):
if title and title[0] in _ignore_starts:
title = title[1:]
match = _title_pat.search(title) match = _title_pat.search(title)
if match: if match:
prep = match.group(1) prep = match.group(1)