Module:Protection banner: Difference between revisions

allow reading wrapper templates and default arguments from the config page
(use pipes as separators instead of hyphens for the protection category keys and validate reasons when we create the protection object to make sure they don't contain pipes)
(allow reading wrapper templates and default arguments from the config page)
Line 783:
function p._main(args, cfg, title)
args = args or {}
cfg = cfg or require('Module:Protection banner/config')
if not cfg then
cfg = require('Module:Protection banner/config')
end
 
-- Initialise the protection object and check for errors
Line 826 ⟶ 824:
end
 
function p.main(frame, cfg)
getArgs = getArgs or require('Module:Arguments').getArgs
if not getArgs then
getArgs cfg = cfg or require('Module:ArgumentsProtection banner/config').getArgs
local defaultArgs = cfg.wrappers[frame:getParent():getTitle()]
local args = getArgs(frame, {parentOnly = defaultArgs and true})
for k, v in pairs(defaultArgs or {}) do
args[k] = v
end
localreturn p._main(args, = getArgs(framecfg)
return p._main(args)
end