Page MenuHomePhabricator

Scribunto: mw.site.namespaces should accept namespace name keys with any capitalisation
Closed, ResolvedPublic

Description

At the moment mw.site.namespaces accepts namespace names as keys if they are correctly capitalised. The following both work:

mw.site.namespaces['Education Program']
mw.site.namespaces['Education_Program']

However, using keys with different capitalisation doesn't work:

mw.site.namespaces['education program'] --> error
mw.site.namespaces['education_program'] --> error
mw.site.namespaces['Education program'] --> error
mw.site.namespaces['Education_program'] --> error
mw.site.namespaces['EdUcAtiOn pRoGrAm'] --> error
mw.site.namespaces['EdUcAtiOn_pRoGrAm'] --> error

However, all of these work when making wikilinks on normal wiki pages. The following will all get you to the same page:

[[Education Program:Example University/Example Course (2013 Q1)]]
[[education program:Example University/Example Course (2013 Q1)]]
[[Education_program:Example University/Example Course (2013 Q1)]]
[[EdUcAtIoN_pRoGrAm:Example University/Example Course (2013 Q1)]]

It would be useful if all of these variants were accepted as keys to mw.site.namespaces. For example, at [[Module:Namespace detect]] I have discovered a bug in the "education program" parameter. The parameter name ("education program") has to match the lower-case value of title.nsText ("education_program"), but they don't match because of the underscore. Allowing both of these as keys would be a neat way to work around the problem.


Version: unspecified
Severity: normal

Details

Reference
bz56216

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:39 AM
bzimport added a project: Scribunto.
bzimport set Reference to bz56216.

I've posted a related issue at Bug 56217.

I've just realised that surrounding whitespace and underscores can work as wikilinks too:

[[_ EdUcAtIon PrOgRaM _:Example University/Example Course (2013 Q1)]]

I think cases like this should also be valid keys.

Change 92886 had a related patch set uploaded by Anomie:
Properly handle spaces/underscores in mw.site.namespaces

https://gerrit.wikimedia.org/r/92886

Change 92886 merged by jenkins-bot:
Properly handle spaces/underscores in mw.site.namespaces

https://gerrit.wikimedia.org/r/92886

Fix is merged. It should be deployed to WMF wikis with 1.23wmf3, see https://www.mediawiki.org/wiki/MediaWiki_1.23/Roadmap for the schedule.