Anonymous user
Module:Namespace detect/data: Difference between revisions
give the argKeys table global scope so that getParamMappings can access it without having to process the cfg table again
(add a getArgKeys function, so that we can have multiple keys for each argument (helpful for localisation) and so that we only have to create that table once per page) |
(give the argKeys table global scope so that getParamMappings can access it without having to process the cfg table again) |
||
Line 13:
end
-- This allows wikis to customise parameter names in the cfg table while
▲ -- Returns a table of parameters to query for each default parameter name.
▲ -- values can be added as a string, or as an array of strings.
local cfgValue = cfg[defaultKey]▼
addKey(t, cfgValue, defaultKey)▼
▲ elseif cfgValueType == 'table' then
elseif cfgValueType == 'table' then
end
cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more.▼
end
end
Line 55 ⟶ 54:
local ustringLower = mw.ustring.lower
local tinsert = table.insert
local subjectNamespaces = mw.site.subjectNamespaces
▲ local talk = cfg.talk
local mappings = {}
mappings[ustringLower(subjectNamespaces[0].name)] =
mappings['talk'] =
for nsid, ns in pairs(subjectNamespaces) do
if nsid ~= 0 then -- Exclude main namespace.
Line 77 ⟶ 76:
return {
argKeys =
cfg = cfg,
mappings = getParamMappings()
|