AresMUSH / aresmush

AresMUSH online text-based game server
Other
30 stars 107 forks source link

Title case breaks on acronyms in profile tabs/TOC. #173

Closed peripety closed 9 months ago

peripety commented 9 months ago

A profile tab or heading named "OOC Notes", as just an example, will appear on the profile or in the page TOC as "Ooc Notes". This is clearly not right. Some ideas:

string_ext.rb suggests it's forcing the whole thing to lowercase, but I think if you just skip downcasing the text, you'll still mis-capitalize a few things like iPhone to IPhone, but at least you won't convert OOC to Ooc. So that's one option.

titlecase gem - This is an older gem but it at least used to work and did a way better job for this sort of thing. I think fairly likely to still be good, since it was just string stuff. This blog post describes the rules and edge case examples used.

Or you could just leave the player input alone; I think in a text-based game, most people are going to capitalize stuff themselves at least as reliably as the current code does, and stick to using coded title-casing only for text that's generated by the app itself.

It's not a big thing, but the fixes seem small enough that there's probably no reason not to go with one of them.

Thanks for your help!

lynnfaraday commented 9 months ago

Thank you for the suggestion. It is usually necessary to normalize the text for comparisons, and downcasing for display is even worse. Changing gems would be problematic with all the existing data that's stored in the database.

Titlecase is the lesser of several evils, and in the occasional case where it misbehaves (such as OOC), it's really just a minor nuisance.

lynnfaraday commented 9 months ago

Oh I forgot to add - I may selectively fix titlecase issues, such as in the profile tabs you mentioned. It's just an overarching overhaul of titlecase that's off the table.