恪別𡧲版𢯢𢷮𧵑「模庉:Category handler」
Keepout2010 (討論 | 㨂𢵰) 造張㵋貝內容「-------------------------------------------------------------------------------- -- -- -- CATEGORY HANDLER -- -- -- -- This module implements the {{category handler}} template in Lua, -- -- with a few improvements: all namespaces and all namespace…」 |
SaigonSarang (討論 | 㨂𢵰) n 𠊝替文本-「Mô đun:」成「Module:」 𥮋:𢯢𢷮移動 Mobile web edit |
||
| 𣳔6: | 𣳔6: | ||
-- with a few improvements: all namespaces and all namespace aliases -- | -- with a few improvements: all namespaces and all namespace aliases -- | ||
-- are supported, and namespace names are detected automatically for -- | -- are supported, and namespace names are detected automatically for -- | ||
-- the local wiki. This module requires [[ | -- the local wiki. This module requires [[Module:Namespace detect]] -- | ||
-- and [[ | -- and [[Module:Yesno]] to be available on the local wiki. It can be -- | ||
-- configured for different wikis by altering the values in -- | -- configured for different wikis by altering the values in -- | ||
-- [[ | -- [[Module:Category handler/config]], and pages can be blacklisted -- | ||
-- from categorisation by using [[ | -- from categorisation by using [[Module:Category handler/blacklist]]. -- | ||
-- -- | -- -- | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- Load required modules | -- Load required modules | ||
local yesno = require(' | local yesno = require('Module:Yesno') | ||
-- Lazily load things we don't always need | -- Lazily load things we don't always need | ||
| 𣳔141: | 𣳔141: | ||
return self._data.currentTitleMatchesBlacklist | return self._data.currentTitleMatchesBlacklist | ||
else | else | ||
mShared = mShared or require(' | mShared = mShared or require('Module:Category handler/shared') | ||
return mShared.matchesBlacklist( | return mShared.matchesBlacklist( | ||
self.title.prefixedText, | self.title.prefixedText, | ||
mw.loadData(' | mw.loadData('Module:Category handler/blacklist') | ||
) | ) | ||
end | end | ||
| 𣳔161: | 𣳔161: | ||
else | else | ||
if not mappings then | if not mappings then | ||
mShared = mShared or require(' | mShared = mShared or require('Module:Category handler/shared') | ||
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData | mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData | ||
end | end | ||
| 𣳔179: | 𣳔179: | ||
end | end | ||
if not mappings then | if not mappings then | ||
mShared = mShared or require(' | mShared = mShared or require('Module:Category handler/shared') | ||
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData | mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData | ||
end | end | ||
| 𣳔244: | 𣳔244: | ||
function p._main(args, data) | function p._main(args, data) | ||
data = data or mw.loadData(' | data = data or mw.loadData('Module:Category handler/data') | ||
local handler = CategoryHandler.new(data, args) | local handler = CategoryHandler.new(data, args) | ||
if handler:isSuppressed() then | if handler:isSuppressed() then | ||
| 𣳔253: | 𣳔253: | ||
function p.main(frame, data) | function p.main(frame, data) | ||
data = data or mw.loadData(' | data = data or mw.loadData('Module:Category handler/data') | ||
local args = require('模庉:Arguments').getArgs(frame, { | local args = require('模庉:Arguments').getArgs(frame, { | ||
wrappers = data.wrappers, | wrappers = data.wrappers, | ||