Module:If preview: Difference between revisions

From Roses, Tulips, & Liberty
Content added Content deleted
(replace is_set with code from Module:Citation/CS1/Utilities. Note previous edit was derived from Module:Citation/CS1/sandbox code.)
(parent.args for pmain, fix boolean function name)
Line 37: Line 37:
Preview_mode = frame:preprocess('{{REVISIONID}}'); -- use magic word to get revision id
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
if not (Preview_mode == nil or Preview_mode == '') then -- if there is a value then this is not a preiview
result = frame.args[2]
result = parent.args[2]
else
else
result = frame.args[1]; -- no value (nil or empty string) so this is a preview
result = parent.args[1]; -- no value (nil or empty string) so this is a preview
end
end
return result
return result
Line 54: Line 54:
]]
]]


function p.main(frame)
function p.boolean(frame)
local result = ''
local result = ''
Preview_mode = frame:preprocess('{{REVISIONID}}'); -- use magic word to get revision id
Preview_mode = frame:preprocess('{{REVISIONID}}'); -- use magic word to get revision id