From 699c9be71f099d7ede04b6d089ae95bf5c52111c Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Mon, 26 Oct 2020 21:20:30 -0400 Subject: [PATCH] Uniformize indentation between Ward and Worm --- lib/convert-worker.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/convert-worker.js b/lib/convert-worker.js index 8d3b2e4..c29163c 100644 --- a/lib/convert-worker.js +++ b/lib/convert-worker.js @@ -57,11 +57,16 @@ function getBodyXML(chapter, book, contentEl) { // useless) child.removeAttribute("align"); - if (child.getAttribute("style") === "text-align:left;") { + const style = child.getAttribute("style"); + if (style === "text-align:left;" || style === "text-align: left;") { child.removeAttribute("style"); } - if (child.getAttribute("style") === "text-align:left;padding-left:30px;") { - child.setAttribute("style", "padding-left:30px;"); + + // Worm uses 30px; Ward mostly uses 40px but sometimes uses 30px/60px. Let's standardize on 30px. + if (style === "text-align:left;padding-left:30px;" || + style === "text-align: left;padding-left: 40px;" || + style === "padding-left: 40px;") { + child.setAttribute("style", "padding-left: 30px;"); } }