From e13ca0de7451ed656a072bd5978b218bcaa9d66b Mon Sep 17 00:00:00 2001
From: Domenic Denicola ......
instead of
.
---
lib/convert.js | 28 ++++++++++++-------------
lib/substitutions.json | 46 +++++++++++++++++++++---------------------
npm-shrinkwrap.json | 5 -----
package.json | 1 -
4 files changed, 37 insertions(+), 43 deletions(-)
diff --git a/lib/convert.js b/lib/convert.js
index 2708a71..457e081 100644
--- a/lib/convert.js
+++ b/lib/convert.js
@@ -2,7 +2,6 @@
const path = require("path");
const fs = require("fs").promises;
const throat = require("throat");
-const serializeToXML = require("xmlserializer").serializeToString;
const { JSDOM } = require("jsdom");
const substitutions = require("./substitutions.json");
@@ -139,10 +138,11 @@ function getBodyXML(chapter, contentEl) {
bodyEl.appendChild(contentEl.firstChild);
}
- let xml = serializeToXML(bodyEl);
+ const xmlSerializer = new contentEl.ownerDocument.defaultView.XMLSerializer();
+ let xml = xmlSerializer.serializeToString(bodyEl);
// Fix recurring strange pattern of extra
in
\n
\s*<\/em><\/p>/g, "
■<\/p>/g, "
■<\/p>/g, "
⊙<\/p>/g, "
⊙<\/strong><\/p>/g, " ⊙<\/strong><\/em><\/p>/g, " ⊙⊙<\/strong><\/p>/g, " ■<\/p>/g, " ■<\/p>/g, " ⊙<\/p>/g, " ⊙<\/strong><\/p>/g, " ⊙<\/strong><\/em><\/p>/g, " ⊙⊙<\/strong><\/p>/g, " Brief note from the author: This story isn’t intended for young or sensitive readers. Readers who are on the lookout for trigger warnings are advised to give Worm a pass. Brief note from the author: This story isn’t intended for young or sensitive readers. Readers who are on the lookout for trigger warnings are advised to give Worm a pass. $1 ([^<]+)( ([^<]+)( $1 ([^<\n]+) ([^<\n]+) $1 $2 "
},
{
- "before": "agreed-upon confidentiality. Both vials"
},
{
@@ -1904,24 +1904,24 @@
"after": " Sweet Honey— Love me, love me, you know you wanna love me… Love me, love me, you know you wanna love me… Love me, love me, you know you wanna love me… Love me, love me, you know you wanna love me… Love me, you? Love me, you? Love me, you? Love me, you? Crazed, kooky, cracked, crazy, Crazed, kooky, cracked, crazy, Crazed, kooky, cracked, crazy, Crazed, kooky, cracked, crazy, Crazed, kooky, cracked, crazy, Crazed, kooky, cracked, crazy, Crazed, kooky, cracked, crazy, Crazed, kooky, cracked, crazy, Crazed, kooky, cracked, crazy, Crazed, kooky, cracked, crazy, She "
+ "before": " Crazed, kooky, cracked, crazy, Crazed, kooky, cracked, crazy, She "
},
{
"before": "Ça va?",
@@ -2206,7 +2206,7 @@
],
"https://parahumans.wordpress.com/2012/09/11/prey-14-3/": [
{
- "before": "truck reached Ward is the second work in the Parahumans series, and reading Worm first is strongly recommended. A lot of this won’t make sense otherwise and if you do find yourself a fan of the universe, the spoilers in Ward will affect the reading of the other work. Ward is not recommended for young or sensitive readers. Ward is the second work in the Parahumans series, and reading Worm first is strongly recommended. A lot of this won’t make sense otherwise and if you do find yourself a fan of the universe, the spoilers in Ward will affect the reading of the other work. Ward is not recommended for young or sensitive readers.
");
- xml = xml.replace(/
");
- xml = xml.replace(/
");
+ xml = xml.replace(/
");
+ xml = xml.replace(/
");
+ xml = xml.replace(/
");
+ xml = xml.replace(/
");
+ xml = xml.replace(/
");
+ xml = xml.replace(/
");
// Fix recurring miscapitalization with questions
xml = xml.replace(/\?”\s\s?She asked/g, "?” she asked");
diff --git a/lib/substitutions.json b/lib/substitutions.json
index 0431645..4264abd 100644
--- a/lib/substitutions.json
+++ b/lib/substitutions.json
@@ -5,7 +5,7 @@
"after": "bugs: flies, ants"
},
{
- "before": "
\n",
+ "before": "
\n",
"after": "",
"_comment": "The pseudo-trigger warning is out of place in an eBook."
}
@@ -906,15 +906,15 @@
"after": "crash when the wave rolled"
},
{
- "regExp": "\n ?\\s*([^<]+)(
|
|
|
|
\n([^>\n]+)
\n",
+ "regExp": "\n
\n([^>\n]+)
\n",
"replacement": "\n
\n■ ",
+ "before": "agreed-upon confidentiality.
\n■ ",
"after": "agreed-upon confidentiality.\n
\n
\n■ ",
+ "regExp": "
\n■ ",
"replacement": "
\nBoth vials",
+ "before": "three, male.
\nBoth vials",
"after": "three, male.
\nLove me, love me, you know you wanna love me…
\nLove me, love me, you know you wanna love me…
\nLove me, love me, you know you wanna love me…
\nLove me, love me, you know you wanna love me…
\nLove me, true?
\nLove me, true?
\nLove me, true?
\nLove me, true?
\nNutty, barmy, mad for me…
\nNutty, barmy, mad for me…
\nNutty, barmy, mad for me…
\nNutty, barmy, mad for me…
\nMental, dotty, whacked, loopy…
\nMental, dotty, whacked, loopy…
\nMental, dotty, whacked, loopy…
\nMental, dotty, whacked, loopy…
\nNutty, screwy, mentally diseased…
\n She ",
- "after": "
\nNutty, screwy, mentally diseased…
\nNutty, screwy, mentally diseased…
\n She ",
+ "after": "
\nNutty, screwy, mentally diseased…
\nthe other Nine",
+ "before": "truck reached
\nthe other Nine",
"after": "truck reached the other Nine"
},
{
@@ -2266,7 +2266,7 @@
],
"https://parahumans.wordpress.com/2012/10/18/interlude-15-donation-bonus/": [
{
- "before": "volunteered, asked
\n to",
+ "before": "volunteered, asked
\n to",
"after": "volunteered, asked to"
},
{
@@ -3365,7 +3365,7 @@
"https://parahumans.wordpress.com/2013/06/25/interlude-24-donation-bonus-1/": [
{
"before": "silence like this. Divide: They",
- "after": "silence like this.
Divide: They"
+ "after": "silence like this.
Divide: They"
},
{
"before": "Bay,” Wanton said. “Not",
@@ -3441,7 +3441,7 @@
},
{
"before": "SimurghNotes",
- "after": "Simurgh
Notes"
+ "after": "Simurgh
Notes"
},
{
"before": "avoided-",
@@ -4238,7 +4238,7 @@
"after": "Imp: I’ve"
},
{
- "before": "Tattletale:
\nwaiting?",
+ "before": "Tattletale:
\nwaiting?",
"after": "Tattletale: waiting?"
},
{
@@ -4308,7 +4308,7 @@
],
"https://www.parahumans.net/2017/09/11/daybreak-1-1/": [
{
- "before": "
",
+ "before": "
",
"after": "",
"_comment": "This is out of place in an eBook."
}
diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json
index c5eb93a..599380f 100644
--- a/npm-shrinkwrap.json
+++ b/npm-shrinkwrap.json
@@ -2060,11 +2060,6 @@
"resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
"integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw=="
},
- "xmlserializer": {
- "version": "0.6.1",
- "resolved": "https://registry.npmjs.org/xmlserializer/-/xmlserializer-0.6.1.tgz",
- "integrity": "sha512-FNb0eEqqUUbnuvxuHqNuKH8qCGKqxu+558Zi8UzOoQk8Z9LdvpONK+v7m3gpKVHrk5Aq+0nNLsKxu/6OYh7Umw=="
- },
"xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
diff --git a/package.json b/package.json
index 90654f3..05b24e9 100644
--- a/package.json
+++ b/package.json
@@ -28,7 +28,6 @@
"jsdom": "^16.2.2",
"requisition": "^1.5.0",
"throat": "^5.0.0",
- "xmlserializer": "^0.6.1",
"yargs": "^15.3.1"
},
"devDependencies": {