Fix a variety of wrong closing quotes

E.g. doubles, "I”ll", backwards
This commit is contained in:
Domenic Denicola 2020-11-14 19:51:20 -05:00
commit b017ab54d1
2 changed files with 51 additions and 31 deletions

View file

@ -171,34 +171,32 @@ function getBodyXML(chapter, book, contentEl) {
xml = xml.replace(/<em>([a-z]+),<\/em>/g, "<em>$1</em>,");
}
function fixQuotesAndApostrophes() {
// Fix recurring poor quotes and apostrophes
xml = xml.replace(/<p>”/g, "<p>“");
xml = xml.replace(/“\s*<\/p>/g, "”</p>");
xml = xml.replace(/“\s*<\/em><\/p>/g, "</em>”</p>");
xml = xml.replace(/\s*<\/p>/g, "</p>");
xml = xml.replace(/\s*<\/em><\/p>/g, "</em></p>");
xml = xml.replace(/,” <\/em>/g, "</em>,” ");
xml = xml.replace(//g, "");
xml = xml.replace(/″/g, "”");
xml = xml.replace(/([A-Za-z])s(\s?)/g, "$1s$2");
xml = xml.replace(/Im/g, "Im");
xml = xml.replace(/<p>“\s+/g, "<p>“");
xml = xml.replace(/'/g, "");
xml = xml.replace(/([A-Za-z]+)/g, "$1");
xml = xml.replace(/([a-z])”<\/p>/g, "$1.”</p>");
}
// 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, "</em>,” ");
fixEms();
fixQuotesAndApostrophes();
xml = xml.replace(/<p>”/g, "<p>“");
xml = xml.replace(/“\s*<\/p>/g, "”</p>");
xml = xml.replace(/“\s*<\/em><\/p>/g, "</em>”</p>");
xml = xml.replace(/\s*<\/p>/g, "</p>");
xml = xml.replace(/\s*<\/em><\/p>/g, "</em></p>");
xml = xml.replace(/,” <\/em>/g, "</em>,” ");
xml = xml.replace(//g, "");
xml = xml.replace(/″/g, "”");
xml = xml.replace(/([A-Za-z])s(\s?)/g, "$1s$2");
xml = xml.replace(/Im/g, "Im");
xml = xml.replace(/<p>“\s+/g, "<p>“");
xml = xml.replace(/'/g, "");
xml = xml.replace(/([A-Za-z]+)/g, "$1");
xml = xml.replace(/([a-z])”<\/p>/g, "$1.”</p>");
fixEms();
xml = xml.replace(/<em>([^<]+)<\/em>/g, "<em>$1</em>");
xml = xml.replace(/I”m/g, "Im");
xml = xml.replace(/<em>([a-z]+)!<\/em>/g, "<em>$1</em>!");
xml = xml.replace(/(?<! {2})<em>([\w ]+)([!.?])”<\/em>/g, "<em>$1</em>$2”");
xml = xml.replace(/<em>([\w ]+[!.?])”<\/em>/g, "<em>$1</em>”");
xml = xml.replace(/I”(m|ll)/g, "I$1");
xml = xml.replace(/””<\/p>/g, "”</p>");
xml = xml.replace(/^([^“]+?) ?”(?![ —<])/gm, "$1 “");
// Similar problems occur in Ward with <b> and <strong> as do in Worm with <em>s
xml = xml.replace(/<b \/>/g, "");

View file

@ -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. ”Weve got teams",
"after": "voice as quiet. “Weve 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": "<strong>Connecting to “agChat.ParahumansOnline016.par:6667” (Attempt 1 of 55)</strong><br />\n<strong>Resolving Host Name</strong><br />\n<strong>Connecting…</strong><br />\n<strong>Connected.</strong><br />\n<strong>Using identity</strong> “<strong>Iblis”, nick “Iblis”<br />\nWelcome to Parahumans Online Chatroom #116, The Holdout. <span style=\"text-decoration:underline;\">Rules Here</span>. Behave. Obey the @s.</strong>",
"after": "<strong>Connecting to “agChat.ParahumansOnline016.par:6667” (Attempt 1 of 55)<br />\nResolving Host Name<br />\nConnecting…<br />\nConnected.<br />\nUsing identity “Iblis”, nick “Iblis”<br />\nWelcome to Parahumans Online Chatroom #116, The Holdout. <span style=\"text-decoration:underline;\">Rules Here</span>. Behave. Obey the @s.</strong>"
}
],
"https://parahumans.wordpress.com/2013/06/29/scarab-25-1/": [
@ -4906,6 +4910,12 @@
"after": "—and from other horrors."
}
],
"https://www.parahumans.net/2018/05/22/torch-7-3/": [
{
"before": "by saying,”Isnt it a rule",
"after": "by saying, “Isnt it a rule"
}
],
"https://www.parahumans.net/2018/05/26/torch-7-4/": [
{
"before": "<p style=\"text-align: center;\"><a href=\"https://www.parahumans.net/2018/05/26/eclipse-x-1/\"><strong>⊙</strong></a></p>",
@ -5447,6 +5457,10 @@
{
"before": "then teacher cant",
"after": "then Teacher cant"
},
{
"before": "“Who is this?”a strange voice asked",
"after": "“Who is this?” a strange voice asked"
}
],
"https://www.parahumans.net/2018/09/13/gleaming-interlude-9-x/": [
@ -5626,12 +5640,6 @@
"_comment": "See comment in https://www.parahumans.net/2018/09/29/gleaming-9-11/"
}
],
"https://www.parahumans.net/2018/10/06/gleaming-9-13/": [
{
"before": "second.”Clarify.”",
"after": "second. “Clarify.”"
}
],
"https://www.parahumans.net/2018/10/09/gleaming-9-14/": [
{
"before": "in a fireman carry. with my free hand",
@ -6383,6 +6391,10 @@
{
"before": "wasnt moms <em>whole</em>",
"after": "wasnt Moms <em>whole</em>"
},
{
"before": "“Fuck,”Capricorn said again",
"after": "“Fuck,” Capricorn said again"
}
],
"https://www.parahumans.net/2019/03/29/heavens-12-x/": [
@ -6689,6 +6701,10 @@
{
"before": "ducked their heads down and hurried</p>",
"after": "ducked their heads down and hurried.</p>"
},
{
"before": "in the way,”she said",
"after": "in the way,” she said"
}
],
"https://www.parahumans.net/2019/10/01/sundown-17-1/": [
@ -6971,6 +6987,12 @@
"after": "Imp and the Heartbroken"
}
],
"https://www.parahumans.net/2020/02/23/infrared-19-z/": [
{
"before": "51 “",
"after": "51″"
}
],
"https://www.parahumans.net/2020/02/25/last-20-1/": [
{
"before": "across this clearing. eyes, cameras",