diff --git a/lib/convert.js b/lib/convert.js index a92ec3e..3d8cee4 100644 --- a/lib/convert.js +++ b/lib/convert.js @@ -50,7 +50,7 @@ function convertChapter(filePath, contentPath) { function getChapterString(rawChapterDoc) { const title = rawChapterDoc.querySelector("h1.entry-title").textContent; - const body = cleanContentEl(rawChapterDoc.querySelector(".entry-content")).innerHTML; + const body = cleanContentEl(rawChapterDoc.querySelector(".entry-content")); return ` @@ -103,7 +103,16 @@ function cleanContentEl(el) { } }); - return el; + let html = el.innerHTML; + + // Fix recurring strange pattern of extra
in

......
\n

+ html = html.replace(/
\s*<\/em><\/p>/g, '

'); + + + // One-off fixes + html = html.replace(/truck reached
\nthe other Nine/, 'truck reached the other Nine'); + + return html; } function isEmptyOrGarbage(el) {