mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix for title sorting, ignore numerics after 1st title word
This commit is contained in:
parent
c0f25a4428
commit
7977386ca0
@ -2296,14 +2296,20 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
# Convert the actual title to a string suitable for sorting.
|
# Convert the actual title to a string suitable for sorting.
|
||||||
# Convert numbers to strings, ignore leading stop words
|
# Convert numbers to strings, ignore leading stop words
|
||||||
# The 21-Day Consciousness Cleanse
|
# The 21-Day Consciousness Cleanse
|
||||||
|
# Scan for numbers in each word clump.
|
||||||
|
|
||||||
title_words = title.split(' ')
|
title_words = title.split()
|
||||||
|
stop_words = ['a','an','the']
|
||||||
# Scan for numbers in each word clump
|
|
||||||
translated = []
|
translated = []
|
||||||
|
|
||||||
|
# Remove the stop words
|
||||||
|
# GwR *** conform this with KG's stop word list
|
||||||
|
while title_words[0].lower() in stop_words:
|
||||||
|
stop_word = title_words.pop(0)
|
||||||
|
|
||||||
for (i,word) in enumerate(title_words):
|
for (i,word) in enumerate(title_words):
|
||||||
hit = re.search('[0-9]+',word)
|
# Don't translate numeric content after first title word
|
||||||
if hit :
|
if i==0 and re.search('[0-9]+',word):
|
||||||
translated.append(EPUB_MOBI.NumberToText(word).text)
|
translated.append(EPUB_MOBI.NumberToText(word).text)
|
||||||
else:
|
else:
|
||||||
translated.append(word)
|
translated.append(word)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user