De-capitalize "giants" but capitalize "X Giant"

This commit is contained in:
Domenic Denicola 2020-12-26 15:35:31 -05:00
commit 5d9a031c02

View file

@ -497,23 +497,23 @@ function fixCapitalization(xml, book) {
xml = xml.replace(/the birdcage/g, "the Birdcage");
// There's no reason why these should be capitalized.
xml = xml.replace(/(?<! {2}|“)Halberd/g, "halberd");
xml = xml.replace(/(?<! {2}|“)Loft/g, "loft");
xml = xml.replace(/(?<! {2}|“|>)Halberd/g, "halberd");
xml = xml.replace(/(?<! {2}|“|>)Loft/g, "loft");
// These are treated as common nouns and not traditionally capitalized. "Krav Maga" remains capitalized,
// interestingly (according to dictionaries and Wikipedia).
xml = xml.replace(/(?<! {2}|“)Judo/g, "judo");
xml = xml.replace(/(?<! {2}|“)Aikido/g, "aikido");
xml = xml.replace(/(?<! {2}|“)Karate/g, "karate");
xml = xml.replace(/(?<! {2}|“)Tae Kwon Do/g, "tae kwon do");
xml = xml.replace(/(?<! {2}|“|>)Judo/g, "judo");
xml = xml.replace(/(?<! {2}|“|>)Aikido/g, "aikido");
xml = xml.replace(/(?<! {2}|“|>)Karate/g, "karate");
xml = xml.replace(/(?<! {2}|“|>)Tae Kwon Do/g, "tae kwon do");
// There's no reason why university should be capitalized in most contexts, although sometimes it's used as part of
// a compound noun or at the beginning of a sentence.
xml = xml.replace(/(?<! {2}|“|Cornell |Nilles )University(?! Road)/, "university");
xml = xml.replace(/(?<! {2}|“|>|Cornell |Nilles )University(?! Road)/, "university");
// Organ names (e.g. brain, arm) or scientific names are not capitalized, so the "corona pollentia" and friends should
// not be either. The books are inconsistent.
xml = xml.replace(/(?<! {2}|“|-)Corona/g, "corona");
xml = xml.replace(/(?<! {2}|“|>|-)Corona/g, "corona");
xml = xml.replace(/Pollentia/g, "pollentia");
xml = xml.replace(/Radiata/g, "radiata");
xml = xml.replace(/Gemma/g, "gemma");
@ -521,7 +521,7 @@ function fixCapitalization(xml, book) {
// We de-capitalize Valkyrie's "flock", since most uses are de-capitalized (e.g. the many instances in Gleaming
// Interlude 9, or Dying 15.z). This is a bit surprising; it seems like an organization name. But I guess it's
// informal.
xml = xml.replace(/(?<! {2}|“)Flock/g, "flock");
xml = xml.replace(/(?<! {2}|“|>)Flock/g, "flock");
// Especially early in Worm, PRT designations are capitalized; they should not be. This fixes the cases where we
// can be reasonably sure they don't start a sentence, although more specific instances are done in
@ -533,7 +533,7 @@ function fixCapitalization(xml, book) {
// This also over-de-capitalizes "The Stranger" in Ward (a titan name). Those also get fixed in substitutions.json.
xml = xml.replace(
// eslint-disable-next-line max-len
/(?<! {2}|>|“|\n|: )(Mover|Shaker|Brute|Breaker|Tinker|Blaster|Thinker|Striker|Changer|Trump|Stranger|Shifter|Shaper)(?! [A-Z])/g,
/(?<! {2}|“|>|\n|: )(Mover|Shaker|Brute|Breaker|Tinker|Blaster|Thinker|Striker|Changer|Trump|Stranger|Shifter|Shaper)(?! [A-Z])/g,
(_, designation) => designation.toLowerCase()
);
xml = xml.replace(
@ -610,6 +610,11 @@ function fixCapitalization(xml, book) {
xml = xml.replace(/Kronos titan/g, "Kronos Titan");
}
// For the giants, the prevailing usage seems to be to keep the term lowercase, but capitalize when used as a name.
xml = xml.replace(/(?<=Mathers |Goddess )giant/g, "Giant");
xml = xml.replace(/mother giant/ig, "Mother Giant");
xml = xml.replace(/(?<! {2}|“|>)Giants/g, "giants");
return xml;
}