LLWiki正在建设中,欢迎加入我们

模块:Sifreward

来自LLWiki
Bob1301讨论 | 贡献2021年5月7日 (五) 16:13的版本 (// 使用Wikiplus小工具快速编辑)
跳转到导航 跳转到搜索

可在模块:Sifreward/doc创建此模块的帮助文档

local p = {}

local getArgs = require("Module:Arguments").getArgs

function p.main(frame)
	local args = getArgs(frame, {parentOnly = true, removeBlanks = false})
	local arg1, arg2, arg3 = mw.ustring.upper(args[1]), (args[2] or ""), mw.ustring.lower(args[3] or "")

	
	local r = tostring( mw.html.create('span'):addClass("game-item")
            :wikitext("[[file:SIF "..arg1..".png|40px|link=]]")
        )

	if arg2 == "" then
		return r
	end

        local color = ""
	if arg3 == "smile" or arg3 == "red" then
		color = "#d1016a"
	elseif  arg3 == "pure" or arg3 == "green" then
		color = "#2da55a"
	elseif arg3 == "cool" or arg3 == "blue" then
		color = "#0f98e3"
	elseif arg3 == "all" or arg3 == "purple" then
		color = "#9a55cc"
	else
		color = "black"
	end

        return r.." '''"..frame:expandTemplate{title = "color", args = {color, arg2}}.."'''"
end

return p