Site Notice
hello, world
Module:UserFunctions
From Project-EPB Commons
https://common.epb.wiki/index.php?title=Module:UserFunctions/doc&action=edit
UserFunctions脚本错误:功能123不存在
UserFunctions脚本错误:功能第一不存在
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p.main(frame)
local args = getArgs(frame)
local type = args[1] or args['type']
-- 识别功能
if type == 'username' then
username(frame)
elseif type == 'usergroup' then
usergroup(frame)
elseif type == '' then
return "<span class=\"error\" data-userfunction=\"no-such-function\">'''UserFunctions脚本错误''':未指定</span>"
else
return "<span class=\"error\" data-userfunction=\"no-such-function\">'''UserFunctions脚本错误''':功能<u>" ..
args[1] .. '</u>不存在</span>'
end
mw.log('UserFunctions')
end
-- 用户名
function username()
local html = mw.html.create()
local resHtml = html:tag('span'):addClass('UserFunctions'):attr('data-type', 'username'):wikitext('用户名'):done()
return tostring(resHtml)
end
function usergroup()
local html = mw.html.create()
local resHtml = html:tag('span'):addClass('UserFunctions'):attr('data-type', 'usergroup'):wikitext('用户组'):done()
return tostring(resHtml)
end
return p