peti / titlecase

Capitalize all English words except articles, coordinating conjunctions, and prepositions (unless they begin or end the title).
http://hackage.haskell.org/package/titlecase
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

Multi-word prepositions cause last word not to be capitalised if it's a preposition #4

Open spagy opened 2 years ago

spagy commented 2 years ago

The last word of a title should be capitalised, but when the last word is a preposition and there is a multi-word preposition before (i.e. not including) the last word, then the last word isn't capitalised.

Contrived example:

>>>  titlecase "far from perfect: things to complain about"
"Far from Perfect: Things to Complain about"

but the result should be "Far from Perfect: Things to Complain About"

spagy commented 2 years ago

this is caused (i think but i haven't tested) by calling succ i in each of parse2, parse3 and parse4 instead of i + 2, i + 3 and i + 4, respectively