local p = {}
local cfg = mw.loadData('Module:If preview/configuration')
function p.main(frame)
if cfg.preview then
return frame.args[1] or ''
else
return frame.args[2] or ''
end
end
function p.pmain(frame)
return p.main(frame:getParent())
end
local function warning_text(warning)
return mw.ustring.format(
cfg.warning_infrastructure,
cfg.templatestyles,
warning
)
end
function p._warning(args)
local warning = args[1] and args[1]:match('^%s*(.-)%s*$') or ''
if warning == '' then
return warning_text(cfg.missing_warning)
end
if not cfg.preview then return '' end
return warning_text(warning)
end
function p.pwarning(frame)
return p._warning(frame:getParent().args)
end
return p