localp={}localcfg=mw.loadData('Module:If preview/configuration')--[[mainThis function returns either the first argument or second argument passed tothis module, depending on whether the page is being previewed.]]functionp.main(frame)ifcfg.previewthenreturnframe.args[1]or''elsereturnframe.args[2]or''endend--[[pmainThis function returns either the first argument or second argument passed tothis module's parent (i.e. template using this module), depending on whether itis being previewed.]]functionp.pmain(frame)returnp.main(frame:getParent())endlocalfunctionwarning_text(warning)returnmw.ustring.format(cfg.warning_infrastructure,cfg.templatestyles,warning)endfunctionp._warning(args)localwarning=args[1]andargs[1]:match('^%s*(.-)%s*$')or''ifwarning==''thenreturnwarning_text(cfg.missing_warning)endifnotcfg.previewthenreturn''endreturnwarning_text(warning)end--[[warningThis function returns a "preview warning", which is the first argument markedup with HTML and some supporting text, depending on whether the page is being previewed.disabled since we'll implement the template version in general]]--function p.warning(frame)-- return p._warning(frame.args)--end--[[warning, but for pass-through templates like {{preview warning}}]]functionp.pwarning(frame)returnp._warning(frame:getParent().args)endreturnp