Module:Category handler/shared and Template:Collapse bottom: Difference between pages

From Computernewb Wiki
(Difference between pages)
Jump to navigation Jump to search
en.wikipedia>MusikAnimal
m (1 revision imported)
 
m (1 revision imported)
 
Line 1: Line 1:
<includeonly>|}</div></includeonly><noinclude>
-- This module contains shared functions used by [[Module:Category handler]]
{{Documentation|Template:Collapse top/doc}}
-- and its submodules.
<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->

</noinclude>
local p = {}

function p.matchesBlacklist(page, blacklist)
for i, pattern in ipairs(blacklist) do
local match = mw.ustring.match(page, pattern)
if match then
return true
end
end
return false
end

function p.getParamMappings(useLoadData)
local dataPage = 'Module:Namespace detect/data'
if useLoadData then
return mw.loadData(dataPage).mappings
else
return require(dataPage).mappings
end
end

function p.getNamespaceParameters(titleObj, mappings)
-- We don't use title.nsText for the namespace name because it adds
-- underscores.
local mappingsKey
if titleObj.isTalkPage then
mappingsKey = 'talk'
else
mappingsKey = mw.site.namespaces[titleObj.namespace].name
end
mappingsKey = mw.ustring.lower(mappingsKey)
return mappings[mappingsKey] or {}
end

return p

Revision as of 19:11, 11 March 2023