模块:Example
此模块的文档可以在模块:Example/doc创建
local module = {}
local getArgs = require('Module:Arguments').getArgs
function _main(args, frame)
local codes = args[1]
local isPrint = args[2] == 'print'
local preTag = frame:extensionTag('pre', codes)
local executedResult = frame:preprocess(
mw.text.decode(
mw.text.unstripNoWiki(codes)
)
)
if isPrint then
return preTag..mw.text.trim(executedResult)
else
frame:callParserFunction('#vardefine', 'example-view', executedResult)
return preTag
end
end
function module.main(frame)
local args = getArgs(frame)
return _main(args, frame)
end
return module