Skip to content

Commit

Permalink
Some inner letters are uppercase when using titlecase
Browse files Browse the repository at this point in the history
Titlecase has an allow list of known acronyms that alwasys remain all uppercase. They were being matched within words though, so "previous" became "PrevIOUs" (since IOU is uppercase).

Changed the match to only occur on word boundaries.
  • Loading branch information
gillibrand committed Mar 25, 2022
1 parent 0a9b065 commit ed630cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions changecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
if len(text.strip()) == 0:
sys.exit(0)

always_uppercase = r'''\bXML|HTML|CSS|JSON|FYI|AOL|ATM|BBC|CD|FAQ|GAIM|GNU|GTK|HIRD|HIV
|HURD|IEEE|IOU|IRA|IUPAC|JPEG|LCD|NAACP|NAC|NATO|NCAA|NOAD|OEM|PHP|ROM|SAT|SFMOMA|SQL|USA|VHDL|VHSIC|W3C
|LOL|WTF\b'''
always_uppercase = r'''\b(?:XML|HTML|CSS|JSON|FYI|AOL|ATM|BBC|CD|FAQ|GAIM|GNU|GTK|HIRD|HIV
|HURD|IEEE|IOU|IRA|IUPAC|JPEG|LCD|NAACP|NAC|NATO|NCAA|NOAD|OEM|PHP|ROM|SAT|SFMOMA|SQL|USA|VHDL|VHSIC|W3C
|LOL|WTF)\b'''
always_uppercase_re = re.compile(always_uppercase, re.I | re.X)


Expand Down

0 comments on commit ed630cc

Please sign in to comment.