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

“模块:Sifreward”的版本间差异

来自LLWiki
跳转到导航 跳转到搜索
(// 使用Wikiplus小工具快速编辑)
(// 使用Wikiplus小工具快速编辑)
第21行: 第21行:
local r = tostring( mw.html.create('span'):addClass("game-item")
local r = tostring( mw.html.create('span'):addClass("game-item")
:wikitext("[[file:SIF "..arg1..".png|40px|link=]]")
:wikitext("[[file:SIF "..arg1..".png|40px|link=]]")
).." "..frame.expandTemplate{title = "color", args = {color, arg2}}
).." "..frame:expandTemplate{title = "color", args = {color, arg2}}
return r
return r

2021年5月7日 (五) 15:57的版本

可在模块: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