“模块:创作者信息”的版本间的差异
跳到导航
跳到搜索
(建立内容为“local StringUtils = require("Module:StringUtils") local ListUtils = require("Module:ListUtils") local p = {} function _missing_maintainer(frame) return frame…”的新页面) |
(没有差异)
|
2020年12月31日 (四) 23:38的版本
此模块的文档可以在模块:创作者信息/doc创建
local StringUtils = require("Module:StringUtils") local ListUtils = require("Module:ListUtils") local p = {} function _missing_maintainer(frame) return frame:expandTemplate{title = "无维护者警告", args = {}} end function _self_post(frame, creator) return frame:expandTemplate{title = "创作者信息/本人发布", args = {['创作者'] = creator}} end function _proxy_post(frame, creator, maintainer) return frame:expandTemplate{title = "创作者信息/委托发布", args = { ['创作者'] = creator, ['维护者']=maintainer}} end function _other_maintainers(frame, other_maintainers) local list = mw.text.listToText(other_maintainers, ",", ",") return frame:expandTemplate{title = "合作维护者", args = {['合作维护者列表'] = list}} end function p.render(frame) local creator = StringUtils.assert_not_empty(frame.args["创作者"]) local maintainer = StringUtils.assert_not_empty(frame.args["维护者"]) local other_maintainers = StringUtils.split_or_empty(frame.args["合作维护者列表"], ",") local result if not creator then creator = maintainer end if maintainer then if maintainer == creator then result = _self_post(frame, creator) else result = _proxy_post(frame, creator, maintainer) end mw.smw.set({ ['Editable by'] = 'whitelist', ['Editable by user'] = ('User:'..maintainer) }) else result = _missing_maintainer(frame) end if other_maintainers[1] then result = result .. _other_maintainers(frame, other_maintainers) end return result end return p