Module:If preview: Difference between revisions

From Roses, Tulips, & Liberty
Content added Content deleted
(module to help templates/modules determine if they are being previewed)
 
(replace is_set with code from Module:Citation/CS1/Utilities. Note previous edit was derived from Module:Citation/CS1/sandbox code.)
Line 14: Line 14:
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
if is_set (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] or '';
result = frame.args[2] or '';
else
else
Line 36: Line 36:
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
if is_set (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 = frame.args[2]
else
else
Line 57: Line 57:
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
if is_set (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 = false;
result = false;
else
else