Module:Category handler: Difference between revisions

Ganaram inukshuk (talk | contribs)
refactor; try to enter category names one by one as unnamed params
Ganaram inukshuk (talk | contribs)
todo; comments
Line 139: Line 139:
function p.category_handler(frame)
function p.category_handler(frame)
local args = getArgs(frame)
local args = getArgs(frame)
local excluded_ns_unparsed = args["excluded_ns"] or ""
local excluded_ns_unparsed = args["excluded_ns"] or "" -- Additional namespaces to exclude (EG, a template that should not be used within main namespace, which is allowed by default)
local suffixes_unparsed    = args["suffixes"  ] or ""
local allowed_ns_unparsed  = args["allowed_ns" ] or "" -- Namespaces to allow; overrides default list (EG, a template that should be used within user namespace, which is disallowed by default)
local suffixes_unparsed    = args["suffixes"  ] or "" -- Additional page suffixes in which to disallow categories
local is_debug = yesno(args["debug"], false) -- Parse debug mode; setting this to TRUE disables all categories
local is_debug = yesno(args["debug"], false) -- Parse debug mode; setting this to TRUE disables all categories


Line 152: Line 153:
end
end
end
end
--[[
for cat in mw.text.gsplit(cats_unparsed, "[;\n]") do
cat = mw.text.trim(cat)
if cat ~= "" then
table.insert(cats, cat)
end
end
]]--


-- Parse excluded namespaces
-- Parse excluded namespaces
Line 173: Line 165:
end
end
end
end
-- TODO: parse allowed namespaces
-- This gets added to the ns_override array, with values set to FALSE


-- Parse excluded suffixes
-- Parse excluded suffixes