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

模块:Sifreward

来自LLWiki
Bob1301讨论 | 贡献2021年5月7日 (五) 15:57的版本 (// 使用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], mw.ustring.lower(args[3])

        local color = ""
	
	if arg3 == "smile" or arg3 == "red" then
		color = color.."#d1016a"
	elseif  arg3 == "pure" or arg3 == "green" then
		color = color.."#2da55a"
	elseif arg3 == "cool" or arg3 == "blue" then
		color = color.."#0f98e3"
	elseif arg3 == "all" or arg3 == "purple" then
		color = color.."#9a55cc"
	end
	
	local r = tostring( mw.html.create('span'):addClass("game-item")
            :wikitext("[[file:SIF "..arg1..".png|40px|link=]]")
        ).." "..frame:expandTemplate{title = "color", args = {color, arg2}}
    
    return r
end

return p