mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Convert sort_title and sort_author to unaccented equivalent using ascii_text(). Titles or Authors with leading accented characters will be sorted with their unaccented equivalent characters.
This commit is contained in:
parent
f1e89942b3
commit
e6306b3824
@ -14,6 +14,7 @@ from calibre.ebooks.chardet import substitute_entites
|
||||
from calibre.ptempfile import PersistentTemporaryDirectory
|
||||
from calibre.utils.config import config_dir
|
||||
from calibre.utils.date import format_date, is_date_undefined, now as nowf
|
||||
from calibre.utils.filenames import ascii_text
|
||||
from calibre.utils.icu import capitalize
|
||||
from calibre.utils.magick.draw import thumbnail
|
||||
from calibre.utils.zipfile import ZipFile
|
||||
@ -689,7 +690,7 @@ Author '{0}':
|
||||
this_title['series'] = None
|
||||
this_title['series_index'] = 0.0
|
||||
|
||||
this_title['title_sort'] = self.generateSortTitle(this_title['title'])
|
||||
this_title['title_sort'] = self.generateSortTitle(ascii_text(this_title['title']))
|
||||
if 'authors' in record:
|
||||
# from calibre.ebooks.metadata import authors_to_string
|
||||
# return authors_to_string(self.authors)
|
||||
@ -704,6 +705,7 @@ Author '{0}':
|
||||
this_title['author_sort'] = record['author_sort']
|
||||
else:
|
||||
this_title['author_sort'] = self.author_to_author_sort(this_title['author'])
|
||||
this_title['author_sort'] = ascii_text(this_title['author_sort'])
|
||||
|
||||
if record['publisher']:
|
||||
this_title['publisher'] = re.sub('&', '&', record['publisher'])
|
||||
@ -780,7 +782,7 @@ Author '{0}':
|
||||
if len(titles):
|
||||
self.booksByTitle = sorted(titles,
|
||||
key=lambda x:(x['title_sort'].upper(), x['title_sort'].upper()))
|
||||
if False and self.verbose:
|
||||
if True and self.verbose:
|
||||
self.opts.log.info("fetchBooksByTitle(): %d books" % len(self.booksByTitle))
|
||||
self.opts.log.info(" %-40s %-40s" % ('title', 'title_sort'))
|
||||
for title in self.booksByTitle:
|
||||
@ -3768,7 +3770,7 @@ Author '{0}':
|
||||
else:
|
||||
word = '%10.0f' % (float(word))
|
||||
translated.append(word)
|
||||
return ' '.join(translated)
|
||||
return ascii_text(' '.join(translated))
|
||||
|
||||
def generateThumbnail(self, title, image_dir, thumb_file):
|
||||
'''
|
||||
|
Loading…
x
Reference in New Issue
Block a user