Modul:Protection banner: Unterschied zwischen den Versionen
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) |
||
Zeile 783: | Zeile 783: | ||
function p._main(args, cfg, title) | function p._main(args, cfg, title) | ||
args = args or {} | args = args or {} | ||
cfg = cfg or require('Module:Protection banner/config') | |||
-- Initialise the protection object and check for errors | -- Initialise the protection object and check for errors | ||
Zeile 826: | Zeile 824: | ||
end | end | ||
function p.main(frame) | function p.main(frame, cfg) | ||
getArgs = getArgs or require('Module:Arguments').getArgs | |||
cfg = cfg or require('Module:Protection banner/config') | |||
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 | end | ||
return p._main(args, cfg) | |||
return p._main(args) | |||
end | end | ||
return p | return p |