Changes
apply changes from sandbox as requested by User:Jackmcbarn which removes middleclass dependency
-- Load required modules
local yesno = require('Module:Yesno')
--------------------------------------------------------------------------------
local CategoryHandler = class('{}CategoryHandler.__index = CategoryHandler')
function CategoryHandler:initialize.new(data, args) self.local obj = setmetatable({ _data = data self., _args = args}, CategoryHandler)
-- Set the title object
do
local pagename = selfobj:parameter('demopage')
local success, titleObj = pcall(mw.title.new, pagename)
if success and titleObj then
else
end
end
-- Set suppression parameter values
for _, key in ipairs{'nocat', 'categories'} do
local value = selfobj:parameter(key)
value = trimWhitespace(value, true)
end
do
local subpage = selfobj:parameter('subpage') local category2 = selfobj:parameter('category2')
if type(subpage) == 'string' then
subpage = mw.ustring.lower(subpage)
subpage = mw.ustring.lower(category2)
end
end
return obj
end
function p._main(args, data)
data = data or mw.loadData('Module:Category handler/data')
local handler = CategoryHandler:.new(data, args)
if handler:isSuppressed() then
return nil