Correctly hyphenate "X-year-old"
This commit is contained in:
parent
56a38609ca
commit
0053545444
1 changed files with 5 additions and 0 deletions
|
|
@ -263,6 +263,11 @@ function getBodyXML(chapter, book, contentEl) {
|
|||
xml = xml.replace(/I-I/g, "I—I");
|
||||
xml = xml.replace(/I-uh/g, "I—uh");
|
||||
|
||||
// "X-year-old" should use hyphens; all grammar guides agree. The books are very inconsistent but most often omit
|
||||
// them.
|
||||
xml = xml.replace(/(\w+)[ -]year[ -]old(s?)(?!\w)/g, "$1-year-old$2");
|
||||
xml = xml.replace(/(\w+) or (\w+)-year-old/g, "$1- or $2-year-old");
|
||||
|
||||
// Fix missing spaces after commas
|
||||
xml = xml.replace(/([a-zA-Z]+),([a-zA-Z]+)/g, "$1, $2");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue