Anonymous user
Module:Category handler: Difference between revisions
apply changes from sandbox as requested by User:Jackmcbarn which removes middleclass dependency
(Rewrite this using Module:Middleclass. It is now more efficient: it only parses parameters when necessary, and caches data with mw.loadData where it can.) |
(apply changes from sandbox as requested by User:Jackmcbarn which removes middleclass dependency) |
||
Line 15:
-- Load required modules
local yesno = require('Module:Yesno')
Line 47 ⟶ 46:
--------------------------------------------------------------------------------
local CategoryHandler =
CategoryHandler.__index = CategoryHandler
function CategoryHandler
local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)
-- Set the title object
do
local pagename =
local success, titleObj = pcall(mw.title.new, pagename)
if success and titleObj then
else
end
end
Line 67 ⟶ 66:
-- Set suppression parameter values
for _, key in ipairs{'nocat', 'categories'} do
local value =
value = trimWhitespace(value, true)
end
do
local subpage =
local category2 =
if type(subpage) == 'string' then
subpage = mw.ustring.lower(subpage)
Line 80 ⟶ 79:
subpage = mw.ustring.lower(category2)
end
end
return obj
end
Line 239:
function p._main(args, data)
data = data or mw.loadData('Module:Category handler/data')
local handler = CategoryHandler
if handler:isSuppressed() then
return nil
|