Title: Module:Category handler/shared - freem URL Source: https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared Markdown Content: _Documentation for this module may be created at [Module:Category handler/shared/doc](https://freemwiki.com/index.php?title=Module:Category\_handler/shared/doc&action=edit&redlink=1 "Module:Category handler/shared/doc (page does not exist)")_ [](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-1)-- This module contains shared functions used by [[Module:Category handler]][](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-2)-- and its submodules.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-3)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-4)local p = {}[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-5)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-6)function p.matchesBlacklist(page, blacklist)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-7)for i, pattern in ipairs(blacklist) do[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-8)local match = mw.ustring.match(page, pattern)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-9)if match then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-10)return true[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-11)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-12)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-13)return false[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-14)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-15)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-16)function p.getParamMappings(useLoadData)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-17)local dataPage = 'Module:Namespace detect/data'[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-18)if useLoadData then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-19)return mw.loadData(dataPage).mappings[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-20)else[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-21)return require(dataPage).mappings[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-22)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-23)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-24)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-25)function p.getNamespaceParameters(titleObj, mappings)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-26)-- We don't use title.nsText for the namespace name because it adds[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-27)-- underscores.[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-28)local mappingsKey[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-29)if titleObj.isTalkPage then[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-30)mappingsKey = 'talk'[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-31)else[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-32)mappingsKey = mw.site.namespaces[titleObj.namespace].name[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-33)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-34)mappingsKey = mw.ustring.lower(mappingsKey)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-35)return mappings[mappingsKey] or {}[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-36)end[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-37)[](https://freemwiki.com/index.php?mobileaction=toggle_view_mobile&title=Module%3ACategory_handler%2Fshared#L-38)return p