Closed 1bakedpotato closed 3 months ago
Hey, thanks! Good idea, but I think it'd be better to use MediaWiki's built in title normalisation functionality in the mw.Title
core module:
mw.Title.newFromUserInput('dragon_dagger').getPrefixedText()
// Dragon dagger
mw.Title.newFromUserInput('RuneScape:user help').getPrefixedText()
// RuneScape:User help
mw.Title.newFromUserInput('runescape:user help').getPrefixedText()
// RuneScape:User help
The only thing to be aware of with this approach is that we'll need to handle the part before and after the URL fragment (if one exists) separately, because this won't work:
mw.Title.newFromUserInput('dragon_dagger#test').getPrefixedText()
// Dragon dagger-test
As referenced in a message in #wiki-tech on the RS Wikis Discord, creating pages via the API with lowercase characters following the first colon in a page title can be problematic. It's difficult to navigate to them, view their history, edit them, or even delete them because MediaWiki tries its best to automatically convert such characters to uppercase.
Since a search for such a (malformed?) title, such as RuneScape:user help will instead be interpreted as "RuneScape:User help", it seems better to ensure these redirects are created with the much more accessible uppercase transformation already applied.