Jump to content

Module:Namespace detect/data: Difference between revisions

found it - mappings[nsname] was getting an upper-case key
m>Mr. Stradivarius
(Undid revision 601018314 by Mr. Stradivarius (talk) looks like that broke something)
m>Mr. Stradivarius
(found it - mappings[nsname] was getting an upper-case key)
Line 52: Line 52:
-- }
-- }
--]]
--]]
local ustringLower = mw.ustring.lower
local tinsert = table.insert
local clone = mw.clone
local subjectNamespaces = mw.site.subjectNamespaces
local mappings = {}
local mappings = {}
mappings[ustringLower(subjectNamespaces[0].name)] = clone(argKeys.main)
local mainNsName = mw.site.subjectNamespaces[0].name
mappings['talk'] = clone(argKeys.talk)
mainNsName = mw.ustring.lower(mainNsName)
for nsid, ns in pairs(subjectNamespaces) do
mappings[mainNsName] = mw.clone(argKeys.main)
mappings['talk'] = mw.clone(argKeys.talk)
for nsid, ns in pairs(mw.site.subjectNamespaces) do
if nsid ~= 0 then -- Exclude main namespace.
if nsid ~= 0 then -- Exclude main namespace.
local nsname = ustringLower(ns.name)
local nsname = mw.ustring.lower(ns.name)
local canonicalName = ustringLower(ns.canonicalName)
local canonicalName = mw.ustring.lower(ns.canonicalName)
mappings[nsname] = {nsname}
mappings[nsname] = {nsname}
if canonicalName ~= nsname then
if canonicalName ~= nsname then
tinsert(mappings[nsname], canonicalName)
table.insert(mappings[nsname], canonicalName)
end
end
for _, alias in ipairs(ns.aliases) do
for _, alias in ipairs(ns.aliases) do
tinsert(mappings[nsname], ustringLower(alias))
table.insert(mappings[nsname], mw.ustring.lower(alias))
end
end
end
end
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.