mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
added author_to_author_sort when author_sort missing
This commit is contained in:
parent
29d6012760
commit
74246c2c5b
@ -840,7 +840,7 @@ class EPUB_MOBI(CatalogPlugin):
|
||||
this_title['title_sort'] = self.generateSortTitle(title)
|
||||
this_title['author'] = " & ".join(record['authors'])
|
||||
this_title['author_sort'] = record['author_sort'] if len(record['author_sort']) \
|
||||
else this_title['author']
|
||||
else self.author_to_author_sort(this_title['author'])
|
||||
this_title['id'] = record['id']
|
||||
if record['publisher']:
|
||||
this_title['publisher'] = re.sub('&', '&', record['publisher'])
|
||||
@ -1983,6 +1983,14 @@ class EPUB_MOBI(CatalogPlugin):
|
||||
outfile.write(self.ncxSoup.prettify())
|
||||
|
||||
# Helpers
|
||||
def author_to_author_sort(self, author):
|
||||
tokens = author.split()
|
||||
tokens = tokens[-1:] + tokens[:-1]
|
||||
if len(tokens) > 1:
|
||||
tokens[0] += ','
|
||||
return ' '.join(tokens)
|
||||
|
||||
|
||||
def convertHTMLEntities(self, s):
|
||||
matches = re.findall("&#\d+;", s)
|
||||
if len(matches) > 0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user