Clean up whitespace before calculating reading ease

This commit is contained in:
Daniel Jönsson 2018-03-13 11:40:10 +01:00
parent 1c8ab8a3e1
commit aa55c36473
2 changed files with 4 additions and 2 deletions

View file

@ -1,6 +1,6 @@
{
"name": "fimfic2epub",
"version": "1.7.4",
"version": "1.7.5",
"description": "Tool to generate improved EPUB ebooks from Fimfiction stories",
"author": "djazz",
"repository": {

View file

@ -388,7 +388,9 @@ class FimFic2Epub extends Emitter {
ch.realWordCount = utils.htmlWordCount(chapter.content)
}
if (this.options.calculateReadingEase && !ch.readingEase) {
ch.readingEase = utils.readingEase(utils.htmlToText(chapter.content))
let text = utils.htmlToText(chapter.content)
text = text.replace(/\s+/g, ' ').trim()
ch.readingEase = utils.readingEase(text)
}
this.progress(0, (i + 1) / this.chapters.length, 'Processed chapter ' + (i + 1) + ' / ' + this.chapters.length)
}).then(() => new Promise((resolve) => setTimeout(resolve, 20)))