diff --git a/lib/convert-worker.js b/lib/convert-worker.js index c810713..660d5ef 100644 --- a/lib/convert-worker.js +++ b/lib/convert-worker.js @@ -53,8 +53,11 @@ function getBodyXML(chapter, bookTitle, contentEl) { } // Remove empty

s or Last Chapter/Next Chapter

s - while (isEmptyOrGarbage(contentEl.lastElementChild)) { - contentEl.lastElementChild.remove(); + while (isEmptyOrGarbage(contentEl.firstChild)) { + contentEl.firstChild.remove(); + } + while (isEmptyOrGarbage(contentEl.lastChild)) { + contentEl.lastChild.remove(); } // Remove redundant attributes and style @@ -137,11 +140,12 @@ function getBodyXML(chapter, bookTitle, contentEl) { const h1El = contentEl.ownerDocument.createElement("h1"); h1El.textContent = chapter.usedTitle; - bodyEl.appendChild(h1El); + bodyEl.append(h1El, "\n\n"); while (contentEl.firstChild) { - bodyEl.appendChild(contentEl.firstChild); + bodyEl.append(contentEl.firstChild); } + bodyEl.append("\n"); const xmlSerializer = new contentEl.ownerDocument.defaultView.XMLSerializer(); let xml = xmlSerializer.serializeToString(bodyEl); diff --git a/lib/substitutions.json b/lib/substitutions.json index a90a365..a919a49 100644 --- a/lib/substitutions.json +++ b/lib/substitutions.json @@ -4619,10 +4619,6 @@ } ], "https://www.parahumans.net/2017/12/01/daybreak-1-8/": [ - { - "before": "

\n

", - "after": "

" - }, { "before": "parahumans online", "after": "Parahumans Online"