模組:Documentation/wrapper
外观
-- 包裹[[Module:Documentation]]不能直接被模板呼叫的函數
local mDocumentation = require('Module:Documentation')
local getArgs = require('Module:Arguments').getArgs
return {
wrapper = function (frame)
local args = frame.args
local method = args.method
if
not method
or not mDocumentation[method]
or method:match('^_') -- reject private function
then
return require('Module:Error').error({'Can\'t find method "' .. method .. '" in [[Module:Documentation]].'})
elseif
mDocumentation['_' .. method] -- reject private function
then
return require('Module:Error').error({'Please use <code>{{#invoke:[[Module:Documentation|Documentation]]|' .. method .. '|...}}</code> instead.'})
end
local env = mDocumentation.getEnvironment(args)
return mDocumentation[method](args, env)
end
}