From 4c1c7cd03df0544f8a89c93141d338925e01407b Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Sun, 29 Nov 2020 15:29:00 -0500
Subject: [PATCH] Remove extra spaces before closing quote marks
---
lib/convert-worker.js | 3 ++-
lib/substitutions.json | 28 ++++++++++++++++++++--------
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/lib/convert-worker.js b/lib/convert-worker.js
index d427070..c4747bc 100644
--- a/lib/convert-worker.js
+++ b/lib/convert-worker.js
@@ -187,6 +187,7 @@ function getBodyXML(chapter, book, contentEl) {
xml = xml.replace(/([A-Za-z])‘s(\s?)/g, "$1’s$2");
xml = xml.replace(/I‘m/g, "I’m");
xml = xml.replace(/“\s+/g, "
“");
+ xml = xml.replace(/\s+”/g, "”");
xml = xml.replace(/'/g, "’");
xml = xml.replace(/’([A-Za-z]+)’/g, "‘$1’");
xml = xml.replace(/([a-z])”<\/p>/g, "$1.”
");
@@ -197,7 +198,7 @@ function getBodyXML(chapter, book, contentEl) {
xml = xml.replace(/([\w ’]+[!.?])”<\/em>/g, "$1”");
xml = xml.replace(/I”(m|ll)/g, "I’$1");
xml = xml.replace(/””<\/p>/g, "”
");
- xml = xml.replace(/^([^“]+?) ?”(?![ —<])/gm, "$1 “");
+ xml = xml.replace(/^([^“]+? ?)”(?![ —<])/gm, "$1 “");
xml = xml.replace(/(?([A-Za-z]+),<\/em>(?!”| +[A-Za-z]+ thought)/, "$1,");
xml = xml.replace(/‘([Kk])ay(?!’)/g, "’$1ay");
diff --git a/lib/substitutions.json b/lib/substitutions.json
index b57c532..d9aed16 100644
--- a/lib/substitutions.json
+++ b/lib/substitutions.json
@@ -372,6 +372,10 @@
{
"before": "so to speak, they",
"after": "so to speak; they"
+ },
+ {
+ "before": "Brian looked across the room,” We’ve",
+ "after": "Brian looked across the room. “We’ve"
}
],
"https://parahumans.wordpress.com/2011/11/12/hive-5-3/": [
@@ -464,6 +468,10 @@
{
"before": "East",
"after": "east"
+ },
+ {
+ "before": "“Yeah,” Newter grinned,” You can tell",
+ "after": "“Yeah,” Newter grinned. “You can tell"
}
],
"https://parahumans.wordpress.com/2011/12/10/interlude-5/": [
@@ -2354,15 +2362,15 @@
"after": "to,” Alexandria spoke, “is"
},
{
- "before": "leave?” Hero asked. ”Why",
+ "before": "leave?” Hero asked.”Why",
"after": "leave?” Hero asked. “Why"
},
{
- "before": "Alexandria said. ”Why",
+ "before": "Alexandria said.”Why",
"after": "Alexandria said. “Why"
},
{
- "before": "voice as quiet. ”We’ve got teams",
+ "before": "voice as quiet.”We’ve got teams",
"after": "voice as quiet. “We’ve got teams"
}
],
@@ -2883,7 +2891,7 @@
],
"https://parahumans.wordpress.com/2013/02/16/interlude-18/": [
{
- "before": "her feet. ”We’re",
+ "before": "her feet.”We’re",
"after": "her feet. “We’re"
}
],
@@ -3546,6 +3554,10 @@
{
"before": "me,” I said. “Is",
"after": "me,” I said, “is"
+ },
+ {
+ "before": "“Help’s on the way.”
",
+ "after": "“Help’s on the way.”
"
}
],
"https://parahumans.wordpress.com/2013/07/25/interlude-26-donation-bonus-1/": [
@@ -5755,10 +5767,6 @@
"before": "post-Prison",
"after": "post-prison"
},
- {
- "before": "to take power!’ ”",
- "after": "to take power!’”"
- },
{
"before": "I’m sorry, what? What?",
"after": "I’m sorry, what? What?"
@@ -7626,6 +7634,10 @@
{
"before": "had harangued the P.R.T., even",
"after": "had harangued the PRT, even"
+ },
+ {
+ "before": "“Actually,” Tattletale said. “I’ve been going",
+ "after": "“Actually,” Tattletale said, “I’ve been going"
}
],
"https://www.parahumans.net/2020/04/21/last-20-e4/": [