local p = {}
function p._getcolor( color )
local colorlist = {
["公告"] = "Pink",
["提醒"] = "Skyblue",
["提醒"] = "Skyblue",
["协助"] = "Orange",
["協助"] = "Orange",
["讨论"] = "LightBlue",
["討論"] = "LightBlue",
["评选"] = "#66F9CF",
["評選"] = "#66F9CF",
["喜讯"] = "PaleGoldenrod",
["喜訊"] = "PaleGoldenrod",
}
if colorlist[color] == nil then
return "transparent"
end
return colorlist[color]
end
function p.item( frame )
local args = frame:getParent().args
prefix = args["prefix"]
if prefix == nil then
prefix = ""
end
suffix = args["suffix"]
if suffix == nil then
suffix = ""
end
separator = args["separator"]
if separator == nil then
separator = "、"
end
conjunction = args["conjunction"]
if conjunction == nil then
conjunction = "及"
end
type = args[1]
if type == nil then
type = "公告"
end
local items = {}
local i = 2
local value
while args[i] ~= nil do
value = mw.text.trim( args[i] )
if value ~= "" then
table.insert( items, value )
end
i = i + 1
end
return '<span class="bulletin-type" style="font-weight: bold; background-color:' ..
p._getcolor(type) .. ';">[' .. type .. ']</span> ' ..
'<span class="bulletin-prefix">' .. prefix .. "</span>" ..
'<span class="bulletin-item">' .. mw.text.listToText(
items,
'</span><span class="bulletin-separator">' .. separator .. '</span><span class="bulletin-item">',
'</span><span class="bulletin-conjunction">' .. conjunction .. '</span><span class="bulletin-item">'
) .. '</span>' ..
'<span class="bulletin-suffix">' .. suffix .. '</span>'
end
return p