More clean-ups; do these at a textual level.
This commit is contained in:
parent
64de4a27e5
commit
f932be159c
1 changed files with 11 additions and 2 deletions
|
|
@ -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 `<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
|
|
@ -103,7 +103,16 @@ function cleanContentEl(el) {
|
|||
}
|
||||
});
|
||||
|
||||
return el;
|
||||
let html = el.innerHTML;
|
||||
|
||||
// Fix recurring strange pattern of extra <br> in <p>...<em>...<br>\n</em></p>
|
||||
html = html.replace(/<br>\s*<\/em><\/p>/g, '</em></p>');
|
||||
|
||||
|
||||
// One-off fixes
|
||||
html = html.replace(/truck reached<br>\nthe other Nine/, 'truck reached the other Nine');
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function isEmptyOrGarbage(el) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue