Apply hyphenation fixes even to capitalized phrases

This commit is contained in:
Domenic Denicola 2020-12-25 15:44:35 -05:00
commit 6256b332cb

View file

@ -628,18 +628,18 @@ function fixHyphens(xml) {
xml = xml.replace(/ haired/g, "-haired");
// These are consistently missing hyphens.
xml = xml.replace(/life threatening/g, "life-threatening");
xml = xml.replace(/hard headed/g, "hard-headed");
xml = xml.replace(/shoulder mounted/g, "shoulder-mounted");
xml = xml.replace(/golden skinned/g, "golden-skinned");
xml = xml.replace(/creepy crawl/g, "creepy-crawl");
xml = xml.replace(/well armed/g, "well-armed");
xml = xml.replace(/able bodied/g, "able-bodied");
xml = xml.replace(/level headed/g, "level-headed");
xml = xml.replace(/clear cut/g, "clear-cut");
xml = xml.replace(/self (conscious|esteem|loathing|harm|destruct|preservation)/g, "self-$2");
xml = xml.replace(/([Ll]ife) threatening/g, "life-threatening");
xml = xml.replace(/([Hh]ard) headed/g, "$1-headed");
xml = xml.replace(/([Ss]houlder) mounted/g, "$1-mounted");
xml = xml.replace(/([Gg]olden) skinned/g, "$1-skinned");
xml = xml.replace(/([Cc]reepy) crawl/g, "$1-crawl");
xml = xml.replace(/([Ww]ell) armed/g, "$1-armed");
xml = xml.replace(/([Aa]ble) bodied/g, "$1-bodied");
xml = xml.replace(/([Ll]evel) headed/g, "$1-headed");
xml = xml.replace(/([Cc]lear) cut/g, "$1-cut");
xml = xml.replace(/([Ss]elf) (conscious|esteem|loathing|harm|destruct|preservation)/g, "$1-$2");
xml = xml.replace(/([Oo]ne|[Tt]wo|[Tt]hree|[Ff]our|[Ff]ourth) dimensional/g, "$1-dimensional");
xml = xml.replace(/(?<=\b)one on one(?=\b)/g, "one-on-one");
xml = xml.replace(/(?<=\b)([Oo]ne) on one(?=\b)/g, "$1-on-one");
// Preemptive(ly) is often hyphenated (not always). It should not be.
xml = xml.replace(/([Pp])re-emptive/g, "$1reemptive");