Changes

Jump to: navigation, search

Module:Namespace detect/data

95 bytes removed, 11:04, 21 March 2014
IMO, aliasing variables like that makes readability worse
-- }
--]]
local ustringLower = mw.ustring.lower
local tinsert = table.insert
local subjectNamespaces = mw.site.subjectNamespaces
local talk = cfg.talk
local mappings = {}
mappings[ustringLowermw.ustring.lower(mw.site.subjectNamespaces[0].name)] = {cfg.main} mappings[cfg.talk] = {cfg.talk} for nsid, ns in pairs(mw.site.subjectNamespaces) do
if nsid ~= 0 then -- Exclude main namespace.
local nsname = ustringLowermw.ustring.lower(ns.name) local canonicalName = ustringLowermw.ustring.lower(ns.canonicalName)
mappings[nsname] = {nsname}
if canonicalName ~= nsname then
tinserttable.insert(mappings[nsname], canonicalName)
end
for _, alias in ipairs(ns.aliases) do
tinserttable.insert(mappings[nsname], ustringLowermw.ustring.lower(alias))
end
end
Anonymous user

Navigation menu