From 51520c11beb22819fbbb1d235dc81563865ca3b7 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Thu, 22 Oct 2020 19:20:29 -0400 Subject: [PATCH] Add an original-URL HTML comment to each chapter This makes it easier for me to figure out how to update substitutions.json. --- lib/convert.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/convert.js b/lib/convert.js index 457e081..a4251be 100644 --- a/lib/convert.js +++ b/lib/convert.js @@ -130,10 +130,14 @@ function getBodyXML(chapter, contentEl) { // Synthesize a tag to serialize const bodyEl = contentEl.ownerDocument.createElement("body"); + const h1El = contentEl.ownerDocument.createElement("h1"); h1El.textContent = chapter.title; - bodyEl.appendChild(h1El); + + const comment = contentEl.ownerDocument.createComment(chapter.url); + bodyEl.appendChild(comment); + while (contentEl.firstChild) { bodyEl.appendChild(contentEl.firstChild); }