跳转到内容

模組:Bulletin

被永久保护的模块
维基百科,自由的百科全书

这是本页的一个历史版本,由Xiplus留言 | 贡献2018年2月13日 (二) 09:03 (.)编辑。这可能和当前版本存在着巨大的差异。

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
    
    local items = {}
    local i = 1
	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(frame.args[1]) .. ';">[' .. frame.args[1] .. ']</span> ' ..
		prefix .. mw.text.listToText( items, separator, conjunction ) .. suffix .. '</li>'
end

return p