跳转到内容

模組:If preview

被永久保护的模块
维基百科,自由的百科全书

这是本页的一个历史版本,由Pseudo Classes留言 | 贡献2020年7月26日 (日) 07:56 (Module)编辑。这可能和当前版本存在着巨大的差异。

(差异) ←上一修订 | 最后版本 (差异) | 下一修订→ (差异)

local p = {}

function p.main(frame)
	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 = frame.args[2] or '';
	else
		result = frame.args[1] or '';									-- no value (nil or empty string) so this is a preview
	end
	return result
end

function p.pmain(frame)
	return p.main(frame:getParent())
end

function p.boolean(frame)
	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 = false;
	else
		result = true;									-- no value (nil or empty string) so this is a preview
	end
	return result
end
 
return p