跳转到内容

模块:沙盒/a2569875/TestVar

维基百科,自由的百科全书
local p = {}

p.text = ''

function p.main()
	local moduleWikitext =  package.loaded["Module:Module wikitext"] or p
	return moduleWikitext._main()
end

function p._main()
	return p.text
end

function p.addText(frame, _preprocessFrame)
	local text = frame
	local preprocessFrame = _preprocessFrame or false
	local yesno = require('Module:Yesno')
	if type(frame) == type(0) then
		text = tostring(frame)
		preprocessFrame = yesno(_preprocessFrame) or false
	elseif type(frame.args) == type({"table"}) then
		text = frame.args.text or frame.args[1] or frame.args['1']  or ''
		preprocessFrame = yesno(frame.args.preprocessFrame) or false
	elseif type(frame) == type({"table"}) then
		text = frame.text or frame[1] or frame['1'] or ''
		preprocessFrame = yesno(frame.preprocessFrame) or false
	end
	if preprocessFrame ~= false then
		text = (preprocessFrame or mw.getCurrentFrame()):preprocess(text)
	end
	local moduleWikitext = package.loaded["Module:Module wikitext"] or p
	moduleWikitext.text = moduleWikitext.text .. text
end

function p._addText(text, preprocessFrame)
	if preprocessFrame ~= false then
		text = (preprocessFrame or mw.getCurrentFrame()):preprocess(text)
	end
	p.text = p.text .. text
end

return p