Module:Sandbox/滝沢朔太郎/UserGroupSysop
跳到导航
跳到搜索
local module = {} ----- 在下方修改各用户组成员列表 ----- local bureaucrat = { { "Baskice", prefix = "<sub>站长</sub>" }, "AnnAngela", "云霞", { "Etolli", postfix = "<sub>暂不参与站务</sub>", active = false } -- active参数仅在false时表示该用户将被[[Template:大召唤术]]忽略。 } local sysop = { "金萌桥姬", "蓝羽汇", "弗霖凯", "北极星与南十字", "Lyhic" } ----- 在上方修改各用户组成员列表 ----- --[[ 供Module:Summon(大召唤术)读取数据的接口。 --]] function module.enumerate() local users = {} local groups = { bureaucrat, sysop, patroller } -- 在上方添加用户组后,在这里添加引用。 for _, group in ipairs(groups) do for _, user in ipairs(group) do if type(user) == "string" and mw.text.trim(user) ~= "" then table.insert(users, mw.text.trim(user)) elseif type(user) == "table" and type(user[1]) == "string" and mw.text.trim(user[1]) ~= "" and user.active ~= false then table.insert(users, mw.text.trim(user[1])) end end end return users end local UserGroupInfo = function(group, frame) local parent = frame:getParent() if parent and parent:getTitle() == "Template:UserGroup" then frame = parent end if frame.args["Count"] then return #group else local list = {} for _, user in ipairs(group) do if type(user) == "string" and mw.text.trim(user) ~= "" then table.insert(list, frame:expandTemplate{ title = "User", args = { user } }) elseif type(user) == "table" and type(user[1]) == "string" and mw.text.trim(user[1]) ~= "" then table.insert(list, frame:preprocess(user.prefix or "").. frame:expandTemplate{ title = "User", args = { user[1] } }.. frame:preprocess(user.postfix or "") ) end end return table.concat(list, " • ") end end function module.bureaucrat(frame) return UserGroupInfo(bureaucrat, frame) end function module.sysop(frame) return UserGroupInfo(sysop, frame) end return module