mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Catalog: Handle embedded series number in title correctly
This commit is contained in:
commit
5fa5974f8e
@ -2296,18 +2296,21 @@ class EPUB_MOBI(CatalogPlugin):
|
||||
# Convert the actual title to a string suitable for sorting.
|
||||
# Convert numbers to strings, ignore leading stop words
|
||||
# The 21-Day Consciousness Cleanse
|
||||
# Scan for numbers in each word clump.
|
||||
from calibre.ebooks.metadata import title_sort
|
||||
|
||||
title_words = title.split(' ')
|
||||
|
||||
# Scan for numbers in each word clump
|
||||
title_words = title_sort(title).split()
|
||||
translated = []
|
||||
|
||||
for (i,word) in enumerate(title_words):
|
||||
hit = re.search('[0-9]+',word)
|
||||
if hit :
|
||||
# Initial numbers translated to text equivalent
|
||||
if i==0 and re.search('[0-9]+',word):
|
||||
translated.append(EPUB_MOBI.NumberToText(word).text)
|
||||
else:
|
||||
if re.search('[0-9]+',word):
|
||||
# Coerce standard-width strings for numbers
|
||||
word = '%03d' % int(re.sub('\D','',word))
|
||||
translated.append(word)
|
||||
|
||||
return ' '.join(translated)
|
||||
|
||||
def generateThumbnail(self, title, image_dir, thumb_file):
|
||||
|
Loading…
x
Reference in New Issue
Block a user