Module:If preview: Difference between revisions

From Roses, Tulips, & Liberty
Content added Content deleted
m (Changed protection level for "Module:If preview": Highly visible page: 1000+ uses ([Edit=Require extended confirmed access] (indefinite)))
(Prune function duplication)
Line 33: Line 33:


function p.pmain(frame)
function p.pmain(frame)
local parent = frame.getParent(frame)
return p.main(frame:getParent())
local result = ''
Preview_mode = frame:preprocess('{{REVISIONID}}'); -- use magic word to get revision id
if not (Preview_mode == nil or Preview_mode == '') then -- if there is a value then this is not a preiview
result = parent.args[2]
else
result = parent.args[1]; -- no value (nil or empty string) so this is a preview
end
return result
end
end