diff --git a/lib/convert-worker.js b/lib/convert-worker.js
index bd9d172..e796a84 100644
--- a/lib/convert-worker.js
+++ b/lib/convert-worker.js
@@ -171,34 +171,32 @@ function getBodyXML(chapter, book, contentEl) {
xml = xml.replace(/([a-z]+),<\/em>/g, "$1,");
}
- function fixQuotesAndApostrophes() {
- // Fix recurring poor quotes and apostrophes
- xml = xml.replace(/ ”/g, " “");
- xml = xml.replace(/“\s*<\/p>/g, "”
“\s+/g, "
“"); - xml = xml.replace(/'/g, "’"); - xml = xml.replace(/’([A-Za-z]+)’/g, "‘$1’"); - xml = xml.replace(/([a-z])”<\/p>/g, "$1.”
"); - } - - // These interact with each other, so do them a few times. + // These quote/apostrophe/em fixes interact with each other. TODO: try to disentangle so we don't repeat all of + // fixEms. xml = xml.replace(/,” <\/em>/g, ",” "); fixEms(); - fixQuotesAndApostrophes(); + xml = xml.replace(/”/g, "
“"); + xml = xml.replace(/“\s*<\/p>/g, "”
"); + xml = xml.replace(/“\s*<\/em><\/p>/g, "”"); + xml = xml.replace(/‘\s*<\/p>/g, "’"); + xml = xml.replace(/‘\s*<\/em><\/p>/g, "’"); + xml = xml.replace(/,” <\/em>/g, ",” "); + xml = xml.replace(/′/g, "’"); + xml = xml.replace(/″/g, "”"); + 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(/'/g, "’"); + xml = xml.replace(/’([A-Za-z]+)’/g, "‘$1’"); + xml = xml.replace(/([a-z])”<\/p>/g, "$1.”
"); fixEms(); xml = xml.replace(/‘([^<]+)<\/em>‘/g, "‘$1’"); - xml = xml.replace(/I”m/g, "I’m"); xml = xml.replace(/([a-z]+)!<\/em>/g, "$1!"); xml = xml.replace(/(?([\w ’]+)([!.?])”<\/em>/g, "$1$2”"); 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 “"); // Similar problems occur in Ward with and as do in Worm with s xml = xml.replace(//g, ""); diff --git a/lib/substitutions.json b/lib/substitutions.json index 9eafa64..3552166 100644 --- a/lib/substitutions.json +++ b/lib/substitutions.json @@ -2361,13 +2361,13 @@ "before": "leave?” Hero asked. ”Why", "after": "leave?” Hero asked. “Why" }, - { - "before": "eye contact. ”She", - "after": "eye contact. “She" - }, { "before": "Alexandria said. ”Why", "after": "Alexandria said. “Why" + }, + { + "before": "voice as quiet. ”We’ve got teams", + "after": "voice as quiet. “We’ve got teams" } ], "https://parahumans.wordpress.com/2012/11/10/colony-15-8/": [ @@ -3408,6 +3408,10 @@ { "before": "Bay,” Wanton said. “Not", "after": "Bay,” Wanton said, “not" + }, + { + "before": "Connecting to “agChat.ParahumansOnline016.par:6667” (Attempt 1 of 55)