Fix capitalization and apostrophes for truncated names

This commit is contained in:
Domenic Denicola 2020-11-14 16:54:19 -05:00
commit c5b13e7cc1
2 changed files with 20 additions and 10 deletions

View file

@ -186,8 +186,6 @@ function getBodyXML(chapter, book, contentEl) {
xml = xml.replace(/<p>“\s+/g, "<p>“");
xml = xml.replace(/'/g, "");
xml = xml.replace(/([A-Za-z]+)/g, "$1");
xml = xml.replace(/Sup/g, "Sup");
xml = xml.replace(/cuz/g, "cuz");
xml = xml.replace(/([a-z])”<\/p>/g, "$1.”</p>");
}
@ -226,6 +224,7 @@ function getBodyXML(chapter, book, contentEl) {
xml = xml.replace(/ ? <\/p>/g, "</p>");
xml = xml.replace(/([a-z]) ,/g, "$1,");
xml = fixTruncatedWords(xml);
xml = fixDialogueTags(xml);
xml = fixForeignNames(xml);
xml = fixEmDashes(xml);
@ -267,6 +266,22 @@ function getBodyXML(chapter, book, contentEl) {
return { xml, warnings };
}
function fixTruncatedWords(xml) {
xml = xml.replace(/Sup/g, "Sup");
xml = xml.replace(/cuz/g, "cuz");
// Short for "Sidepeace"
xml = xml.replace(/[][Pp]iece(?![a-z])/g, "Piece");
// Short for "Disjoint"
xml = xml.replace(/[][Jj]oint(?![a-z])/g, "Joint");
// Short for "Contender"
xml = xml.replace(/[][Tt]end(?![a-z])/g, "Tend");
return xml;
}
function fixDialogueTags(xml) {
// Fix recurring miscapitalization with questions
xml = xml.replace(/\?”\s\s?She asked/g, "?” she asked");
@ -428,6 +443,9 @@ function fixCapitalization(xml, book) {
// ReSound's name is sometimes miscapitalized. The word is never used in a non-name context.
xml = xml.replace(/Resound/g, "ReSound");
// The Speedrunners team name is missing its capitalization a couple times.
xml = xml.replace(/speedrunners/g, "Speedrunners");
// "patrol block" is capitalized three different ways: "patrol block", "Patrol block", and "Patrol Block". "patrol
// group" is always lowercased. It seems like "Patrol" is a proper name, and is used as a capitalized modifier in
// other contexts (e.g. Patrol leader). So let's standardize on "Patrol <lowercase>".

View file

@ -4628,10 +4628,6 @@
}
],
"https://www.parahumans.net/2018/03/10/shadow-5-5/": [
{
"before": "Dont fucking hit me, piece",
"after": "Dont fucking hit me, piece"
},
{
"before": "out of the back, “She still would have",
"after": "out of the back, “she still would have"
@ -5847,10 +5843,6 @@
"before": "confines of the suit. and rearranged herself",
"after": "confines of the suit, and rearranged herself"
},
{
"before": "piece",
"after": "piece"
},
{
"before": "Fuck y—of course",
"after": "Fuck y— Of course"