https://para.wiki/h/Module:Category_handler/shared?feed=atom&Module:Category handler/shared - Revision history2024-03-29T14:45:52ZRevision history for this page on the wikiMediaWiki 1.40.0https://para.wiki/index.php?title=Module:Category_handler/shared&diff=12369&oldid=previmported>ConsciousCode: Created page with "-- This module contains shared functions used by Module:Category handler -- and its submodules. local p = {} function p.matchesBlacklist(page, blacklist) for i, pattern..."2014-08-11T06:04:40Z<p>Created page with "-- This module contains shared functions used by <a href="/w/Module:Category_handler" title="Module:Category handler">Module:Category handler</a> -- and its submodules. local p = {} function p.matchesBlacklist(page, blacklist) for i, pattern..."</p>
<p><b>New page</b></p><div>-- This module contains shared functions used by [[Module:Category handler]]<br />
-- and its submodules.<br />
<br />
local p = {}<br />
<br />
function p.matchesBlacklist(page, blacklist)<br />
for i, pattern in ipairs(blacklist) do<br />
local match = mw.ustring.match(page, pattern)<br />
if match then<br />
return true<br />
end<br />
end<br />
return false<br />
end<br />
<br />
function p.getParamMappings(useLoadData)<br />
local dataPage = 'Module:Namespace detect/data'<br />
if useLoadData then<br />
return mw.loadData(dataPage).mappings<br />
else<br />
return require(dataPage).mappings<br />
end<br />
end<br />
<br />
function p.getNamespaceParameters(titleObj, mappings)<br />
-- We don't use title.nsText for the namespace name because it adds<br />
-- underscores.<br />
local mappingsKey<br />
if titleObj.isTalkPage then<br />
mappingsKey = 'talk'<br />
else<br />
mappingsKey = mw.site.namespaces[titleObj.namespace].name<br />
end<br />
mappingsKey = mw.ustring.lower(mappingsKey)<br />
return mappings[mappingsKey] or {}<br />
end<br />
<br />
return p</div>imported>ConsciousCode