|Reported by:||Mike Lissner||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The title case function is a bit naively implemented, and could be vastly improved by pulling in some functionality from other titlecase tools.
Some things (I think) it doesn't cover:
- small words shouldn't be capitalized (a, an, the, and, etc.), except when they are the first word in the string ("A Walk in the Park")
- words like "Q&A" and "AT&T" should work
- apostrophes: "AT&T's Network", "O'Donnell", "Don't"
- hyphenated words: "Dangerously-Endowed"
- Mc: "McDonald's"
It would also be great if it had a variable that could contain words that should be uppercase, such as:
TITLE_BIG_WORDS = ("FBI", "CIA", "SEC", "EFF",)
There are some good reference implementations of this, but probably the best is this one: https://bugs.launchpad.net/titlecase.py
Change History (4)
comment:1 Changed 6 years ago by
|Patch needs improvement:||unset|