模組:Bulletin
外观
local p = {}
function p._getcolor( color )
local colorlist = {
["公告"] = "Pink",
["人事"] = "LightGreen",
["投票"] = "LightGreen",
["编辑"] = "LightGreen",
["讨论"] = "LightBlue",
["討論"] = "LightBlue",
["請求"] = "Orange",
["请求"] = "Orange",
["通知"] = "Skyblue",
["调查"] = "Yellow",
["調查"] = "Yellow",
["聚會"] = "PaleGoldenrod",
["聚会"] = "PaleGoldenrod",
["獎勵"] = "PaleGoldenrod",
["奖励"] = "PaleGoldenrod",
["解任"] = "#99FF4D",
["離任"] = "#99FF4D",
["离任"] = "#99FF4D"
}
if colorlist[color] == nil then
return "transparent"
end
return colorlist[color]
end
function p.item( frame )
prefix = frame.args["prefix"]
if prefix == nil then
prefix = ""
end
suffix = frame.args["suffix"]
if suffix == nil then
suffix = ""
end
separator = frame.args["separator"]
if separator == nil then
separator = "、"
end
conjunction = frame.args["conjunction"]
if conjunction == nil then
conjunction = "及"
end
type = frame.args[1]
if type == nil then
type = "公告"
end
local items = {}
local i = 2
while frame.args[i] ~= nil do
table.insert( items, frame.args[i] )
i = i + 1
end
return '<li><span style="font-weight: bold; background-color:' ..
p._getcolor(type) .. ';">[' .. type .. ']</span> ' ..
prefix .. mw.text.listToText( items, separator, conjunction ) .. suffix .. '</li>'
end
return p