模块:Gltd-Archive.lua:修订间差异
来自「荏苒之境」
无编辑摘要 |
无编辑摘要 |
||
第3行: | 第3行: | ||
local archive = {} | local archive = {} | ||
local | local PERMISSION_COLORS = { | ||
"rgb(80, 119, 86)", | "rgb(80, 119, 86)", | ||
"rgb(177, 160, 89))", | "rgb(177, 160, 89))", | ||
第11行: | 第11行: | ||
} | } | ||
local | local TEMPLATE = | ||
[[<div style="border: 5px solid ${color}; padding-bottom: 0.5em; background-color: rgb(80, 119, 86); color: white;"> | [[<div style="border: 5px solid ${color}; padding-bottom: 0.5em; background-color: rgb(80, 119, 86); color: white;"> | ||
<h4 style="text-align: center;">${id}</h4> | <h4 style="text-align: center;">${id}</h4> | ||
第18行: | 第18行: | ||
archive.show = function(frame) | archive.show = function(frame) | ||
local permission = frame.args.permission | local permission = tonumber(frame.args.permission) or 1 | ||
return interp( | return interp(TEMPLATE, { | ||
id = frame.args.id, | id = frame.args.id, | ||
color = | color = PERMISSION_COLORS[permission], | ||
permission = permission, | permission = permission, | ||
event_group = frame.args.event_group, | event_group = frame.args.event_group, |
2025年7月30日 (三) 12:30的版本
此模块的文档可以在模块:Gltd-Archive.lua/doc创建
local interp = require("Module:Interp.lua")
local archive = {}
local PERMISSION_COLORS = {
"rgb(80, 119, 86)",
"rgb(177, 160, 89))",
"rgb(215, 122, 50)",
"rgb(215, 56, 51)",
"black"
}
local TEMPLATE =
[[<div style="border: 5px solid ${color}; padding-bottom: 0.5em; background-color: rgb(80, 119, 86); color: white;">
<h4 style="text-align: center;">${id}</h4>
<p style="text-align: center;">本档案已被「荏苒之境」理事会锁定,权限级:${permission}。</p>
</div>]]
archive.show = function(frame)
local permission = tonumber(frame.args.permission) or 1
return interp(TEMPLATE, {
id = frame.args.id,
color = PERMISSION_COLORS[permission],
permission = permission,
event_group = frame.args.event_group,
})
end
return archive