Page MenuHomePhabricator

Scribunto: Title object namespace text should use spaces rather than underscores
Closed, ResolvedPublic

Description

The Lua code:

mw.title.new('Wikipedia talk:Articles for deletion').prefixedText

Gives the result:

"Wikipedia_talk:Articles for deletion"

Most users will be expecting spaces rather than underscores, as that is what is normally used in wikilinks on Wikipedia. Using underscores also causes problems if you try to test for equality between title.nsText and mw.site.namespaces[namespace].name:

mw.title.new('Wikipedia talk:Articles for deletion').nsText --> "Wikipedia_talk"
mw.site.namespaces['Wikipedia_talk'].name --> "Wikipedia talk"

Having these two commands produce different text seems counterintuitive to me.

I've posted a related issue at Bug 56216.


Version: unspecified
Severity: normal

Details

Reference
bz56217

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:39 AM
bzimport set Reference to bz56217.

The behavior of .nsText is as intended, as it matches Title::getNsText() in PHP. You shouldn't test for equality between .nsText and .name, test .namespace and .id instead.

Change 92887 had a related patch set uploaded by Anomie:
Regularize whitespace handling in mw.title

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

Change 92887 merged by jenkins-bot:
Regularize whitespace handling in mw.title

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

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.