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 mappings = {} | local mappings = {} | ||
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 = | local nsname = mw.ustring.lower(ns.name) | ||
local canonicalName = | local canonicalName = mw.ustring.lower(ns.canonicalName) | ||
mappings[nsname] = {nsname} | mappings[nsname] = {nsname} | ||
if canonicalName ~= nsname then | if canonicalName ~= nsname then | ||
table.insert(mappings[nsname], canonicalName) | |||
end | end | ||
for _, alias in ipairs(ns.aliases) do | for _, alias in ipairs(ns.aliases) do | ||
table.insert(mappings[nsname], mw.ustring.lower(alias)) | |||
end | end | ||
end | end |