Module:NAMESPACEID
Appearance
Henda module verður nýtt in Template:Editnotice load/core. Changes to it can cause immediate changes to the Wikipedia user interface. To avoid large-scale disruption, any changes should first be tested in this template's /sandbox or /testcases subpage, or in your own user space. The tested changes can then be added in one single edit to this template. Please discuss any changes at the talk page before implementing them. |
This module returns the namespace ID of a page. It must be used via a template, typically the {{NAMESPACEID}} template.
-- This module implements {{NAMESPACEID}}.
local p = {}
function p.main(frame)
local ns = frame:getParent().args[1] or mw.title.getCurrentTitle().namespace
local nsTable = mw.site.namespaces[ns]
if nsTable then
return nsTable.id
else
return '<strong class="error">Invalid namespace in ' ..
'{{[[Template:NAMESPACEID|NAMESPACEID]]}}</strong>'
end
end
return p