Revise the chapter URL comments
This commit is contained in:
parent
699c9be71f
commit
bcca56866c
1 changed files with 5 additions and 5 deletions
|
|
@ -119,9 +119,6 @@ function getBodyXML(chapter, book, contentEl) {
|
||||||
h1El.textContent = chapter.title;
|
h1El.textContent = chapter.title;
|
||||||
bodyEl.appendChild(h1El);
|
bodyEl.appendChild(h1El);
|
||||||
|
|
||||||
const comment = contentEl.ownerDocument.createComment(chapter.url);
|
|
||||||
bodyEl.appendChild(comment);
|
|
||||||
|
|
||||||
while (contentEl.firstChild) {
|
while (contentEl.firstChild) {
|
||||||
bodyEl.appendChild(contentEl.firstChild);
|
bodyEl.appendChild(contentEl.firstChild);
|
||||||
}
|
}
|
||||||
|
|
@ -458,8 +455,11 @@ function getBodyXML(chapter, book, contentEl) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Serializer inserts extra xmlns for us since it doesn't know we're going to put this into a <html>
|
// Serializer inserts extra xmlns for us since it doesn't know we're going to put this into a <html>.
|
||||||
xml = xml.replace(/<body xmlns="http:\/\/www.w3.org\/1999\/xhtml">/, "<body>");
|
// Use this opportunity to insert a comment pointing to the original URL, for reference.
|
||||||
|
xml = xml.replace(
|
||||||
|
/<body xmlns="http:\/\/www.w3.org\/1999\/xhtml">/,
|
||||||
|
`<body>\n<!-- ${chapter.url} -->\n`);
|
||||||
|
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue