Changes
Jump to navigation
Jump to search
Module:Namespacedata (view source)
Revision as of 09:44, 28 September 2017
, 09:44, 28 September 2017no edit summary
-- Shows local namespace names
local p = {}
local mapping = {["content"] = "contentNamespaces", ["subject"] = "subjectNamespaces", ["talk"] = "talkNamespaces"}
function p.main(frame)
local workingFrame, namespaces = frame
if frame and frame:getParent() and workingFrame then
workingFrame = frame:getParent();
namespaces = workingFrame.args[1] or frame.args[1]
end
local output = ""
local queryNamespaces = mw.site[mapping[namespaces]]
if (not queryNamespaces ) then
return
end
for i, v in pairs (queryNamespaces) do
output = output .. (v.displayName or v.canonicalName) .." (".. i ..") ·"
end
mw.logObject(queryNamespaces)
return output
end
return p
local p = {}
local mapping = {["content"] = "contentNamespaces", ["subject"] = "subjectNamespaces", ["talk"] = "talkNamespaces"}
function p.main(frame)
local workingFrame, namespaces = frame
if frame and frame:getParent() and workingFrame then
workingFrame = frame:getParent();
namespaces = workingFrame.args[1] or frame.args[1]
end
local output = ""
local queryNamespaces = mw.site[mapping[namespaces]]
if (not queryNamespaces ) then
return
end
for i, v in pairs (queryNamespaces) do
output = output .. (v.displayName or v.canonicalName) .." (".. i ..") ·"
end
mw.logObject(queryNamespaces)
return output
end
return p