ppannuto / python-titlecase

Python library to capitalize strings as specified by the New York Times Manual of Style
MIT License
244 stars 36 forks source link

Small words are erroneously capitalized within hyphenated compound words #62

Closed igorburago closed 4 years ago

igorburago commented 4 years ago

When titlecase() recurses to process separate words of a hyphenated compound word, it passes on the current value of the small_first_last parameter unchanged. Naturally, this leads to incorrect title-casing of compound words, containing small words.

For instance, words end-to-end and work-in-progress are currently title-cased as End-To-End and Work-In-Progress instead of the correct End-to-End and Work-in-Progress.

igorburago commented 4 years ago

Unless I am missing something, small_first_last should always be False when we are recursing into the parts of a compound word, regardless of whether those parts are joined with slashes or hyphens. See #63.

sboisen commented 3 years ago

I don't think this issue is fixed in 1.1.1

>>> titlecase.titlecase("mother-in-law")
'Mother-In-Law'

should not capitalize "in"