mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
When downloading metadata, fix the case normalization of double-barelled names. Fixes #893257 (Fetching metadata: Minuscules in the second part of hyphenated double-barrelled names)
This commit is contained in:
parent
508b6e4613
commit
a8fb3b2025
@ -15,7 +15,7 @@ from calibre.customize import Plugin
|
||||
from calibre.utils.logging import ThreadSafeLog, FileStream
|
||||
from calibre.utils.config import JSONConfig
|
||||
from calibre.utils.titlecase import titlecase
|
||||
from calibre.utils.icu import capitalize, lower
|
||||
from calibre.utils.icu import capitalize, lower, upper
|
||||
from calibre.ebooks.metadata import check_isbn
|
||||
|
||||
msprefs = JSONConfig('metadata_sources/global.json')
|
||||
@ -121,7 +121,12 @@ def cap_author_token(token):
|
||||
# Normalize tokens of the form J.K. to J. K.
|
||||
parts = token.split('.')
|
||||
return '. '.join(map(capitalize, parts)).strip()
|
||||
return capitalize(token)
|
||||
ans = capitalize(token)
|
||||
for x in ('-', "'"):
|
||||
idx = ans.find(x)
|
||||
if idx > -1 and len(ans) > idx+2:
|
||||
ans = ans[:idx+1] + upper(ans[idx+1]) + ans[idx+2:]
|
||||
return ans
|
||||
|
||||
def fixauthors(authors):
|
||||
if not authors:
|
||||
|
Loading…
x
Reference in New Issue
Block a user