More fixups, through 30.2

This commit is contained in:
Domenic Denicola 2015-05-23 22:53:36 -04:00
commit 230f049fed
2 changed files with 240 additions and 4 deletions

View file

@ -154,6 +154,7 @@ function getBodyXml(chapter, contentEl) {
xml = xml.replace(/“<em>([^>]+)<\/em>(!|\?|\.)”/g, "“<em>$1$2<\/em>”");
xml = xml.replace(/<p><em>([^>]+)<\/em>(!|\?|\.)<\/p>/g, "<p><em>$1$2<\/em></p>");
xml = xml.replace(/(!|\?|\.)\s{2}<\/em><\/p>/g, "$1</em></p>");
xml = xml.replace(/<em>([a-z]+)\?<\/em>/g, "<em>$1</em>?");
// Fix recurring poor quotes and apostrophes
xml = xml.replace(/<p>”/g, "<p>“");
@ -161,11 +162,13 @@ function getBodyXml(chapter, contentEl) {
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, "");
// Fixes dashes
xml = xml.replace(/ /g, "—");
@ -191,6 +194,10 @@ function getBodyXml(chapter, contentEl) {
// Replace single-word <i>s with <em>s. Other <i>s are probably erroneous too, but these are known-bad.
xml = xml.replace(/<i>([A-Za-z]+)<\/i>/g, "<em>$1</em>");
// This occurs enough times it's better to do here than in one-off fixes. We correct the single instance where
// it's incorrect to capitalize in the one-off fixes.
xml = xml.replace(/the clairvoyant/g, "the Clairvoyant");
// One-off fixes
(substitutions[chapter.url] || []).forEach(function (substitution) {
const indexOf = xml.indexOf(substitution.before);