模組:Category handler/shared
Kàu tō-lám
跳至搜尋
| 本-{zh-hans: 模箍; zh-hant: 模組;}-已全域手動同步。 請注意,若你修改在地的-{zh-hans: 模箍; zh-hant: 模組; }-,欲可能影響同步。 |
| 此Module予人引用佇系統介面中。 任何對這Module的修改會隨反映佇維基百科的-{zh-hans:用戶; zh-hant:用戶; zh-tw:使用者}-介面。 為著避免造成大規模的影響,编者可以在本-{zh-cn:模块; zh-tw:模組}-的沙盒和测试样例页面进行实验。 試驗了後無誤的版本會當一擺性來加入這Module中,毋過修改前請務必佇乞論頁起鼓討論。 |
-{H|zh-hans:重定向; zh-hant:閣再導向;}--{H|zh-cn:文字; zh-tw:字元;}--{H|zh-hans:文件; zh-hant:檔案;}--{H|zh-hans:快捷方式; zh-hant:捷徑;}--{H|zh-hans:項目; zh-hant:專案; zh-tw:計畫; zh-hk:計畫; zh-mo:計畫;}--{H|zh-cn:計算機; zh-sg:電腦; zh-tw:電腦;}-Lua 錯誤 於第53行的模組:Effective_protection_level中:attempt to index field 'TitleBlacklist' (a nil value)。
-- This module contains shared functions used by [[Module:Category handler]]
-- and its submodules.
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