Page MenuHomePhabricator

add a variable and parser function for the namespace number
Closed, ResolvedPublic

Description

The {{NAMESPACE}} variable always give the namespace text, but this text can change, due to a configuration or localisation change. Having a way to get the namespace number makes it possible to avoid a breaking of conditions or transclusion by a change of a namespace.

Using {{NAMESPACE}} and {{ns:0}} inside a #ifeq does not have this problem, but when using the {{NAMESPACE}} in transclusion of a page, you have this problem or you have to use a big switch to map the name against the number, but getting the number direct from MediaWiki sounds better.

Please add a {{NAMESPACENUMBER}} variable and also a parser function {{NAMESPACENUMBER:pagename}} (like NAMESPACE).

Maybe call it NAMESPACEID, I am not sure, which is a better name.

Thanks.


Version: 1.20.x
Severity: enhancement

Details

Reference
bz34355

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:11 AM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz34355.
bzimport added a subscriber: Unknown Object (MLST).

I'm a bit leery of this because the ids may become much more variable in the future... but it's probably not a problem to do.

Workaround: [[de:Vorlage:NAMESPACENUMBER]]

Commited a patch with gerrit 4056