mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Fix #2116784 [author_use_surname_prefixes is always false when surname contains accented character](https://bugs.launchpad.net/calibre/+bug/2116784)
This commit is contained in:
parent
acbbe86141
commit
3b762b9781
@ -97,7 +97,8 @@ def author_to_author_sort(
|
|||||||
|
|
||||||
author_use_surname_prefixes = tweaks['author_use_surname_prefixes'] if use_surname_prefixes is None else use_surname_prefixes
|
author_use_surname_prefixes = tweaks['author_use_surname_prefixes'] if use_surname_prefixes is None else use_surname_prefixes
|
||||||
if author_use_surname_prefixes:
|
if author_use_surname_prefixes:
|
||||||
author_surname_prefixes = frozenset(x.lower() for x in (tweaks['author_surname_prefixes'] if surname_prefixes is None else surname_prefixes))
|
author_surname_prefixes = frozenset(
|
||||||
|
force_unicode(x).lower() for x in (tweaks['author_surname_prefixes'] if surname_prefixes is None else surname_prefixes))
|
||||||
if len(tokens) == 2 and tokens[0].lower() in author_surname_prefixes:
|
if len(tokens) == 2 and tokens[0].lower() in author_surname_prefixes:
|
||||||
return author
|
return author
|
||||||
|
|
||||||
|
@ -102,6 +102,9 @@ class TestAuthorToAuthorSort(unittest.TestCase):
|
|||||||
self.check_all_methods('Leonardo Da Vinci',
|
self.check_all_methods('Leonardo Da Vinci',
|
||||||
invert='Da Vinci, Leonardo',
|
invert='Da Vinci, Leonardo',
|
||||||
nocomma='Da Vinci Leonardo')
|
nocomma='Da Vinci Leonardo')
|
||||||
|
self.check_all_methods('Liam Da Mathúna',
|
||||||
|
invert='Da Mathúna, Liam',
|
||||||
|
nocomma='Da Mathúna Liam')
|
||||||
self.check_all_methods('Van Gogh')
|
self.check_all_methods('Van Gogh')
|
||||||
self.check_all_methods('Van')
|
self.check_all_methods('Van')
|
||||||
with Tweak('author_use_surname_prefixes', False):
|
with Tweak('author_use_surname_prefixes', False):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user