Page MenuHomePhabricator

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


The Lua code:'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[namespace].name:'Wikipedia talk:Articles for deletion').nsText --> "Wikipedia_talk"['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



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

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

Fix is merged. It should be deployed to WMF wikis with 1.23wmf3, see for the schedule.