local p = {} local function notempty(s) return (s ~= "" and s) end local getArgs = require("Module:Arguments").getArgs local function wikitext(text1) return mw.getCurrentFrame():preprocess(text1) end local titleset = { --添加数据格式:["参数"]={"image","link","width",color","text"} ["default"]={"Red_alert.png","命令与征服:红色警戒系列","99","red","萌娘百科欢迎您参与完善本条目☆Welcome Back, Commander!"}, ["苏联"]={"Soviet-Logo.png","命令与征服:红色警戒系列","90","red","萌娘百科欢迎您参与完善本条目☆For the Union!"}, ["盟军"]={"Allied-Logo.png","命令与征服:红色警戒系列","90","blue","萌娘百科欢迎您参与完善本条目☆Welcome Back, Commander!"}, ["尤里"]={"Yuri-Logo.png","命令与征服:红色警戒系列","90","purple","萌娘百科欢迎您参与完善本条目☆Be one with Yuri!"}, ["心灵终结"]={"Mo3logo.png","心灵终结","99","#800080","萌娘百科欢迎您参与完善本条目☆Chivalry is not dead!"}, ["日冕"]={"Cor_logo.png","日冕(红色警戒3mod)","90","#FC430D","萌娘百科欢迎您参与完善本条目☆天下大同!"} } function p.main(frame) local title = notempty(frame.args[1]) or "default" local print = '{{#vardefine:image|' .. titleset[title][1] .. '}}' print = print .. '{{#vardefine:link|' .. titleset[title][2] .. '}}' print = print .. '{{#vardefine:width|' .. titleset[title][3] .. '}}' print = print .. '{{#vardefine:color|' .. titleset[title][4] .. '}}' print = print .. '{{#vardefine:text|' .. titleset[title][5] .. '}}' return wikitext(print) end function p.check() local button ='{{切换显示按钮|@default=default|@radio=1|@forceNoCancel=1' local content ='' for k,v in pairs(titleset) do button = button .. '|' .. k .. '=' .. k content = content .. '{{切换显示|' .. k .. '|' .. '<code><nowiki>{{红色警戒TOP|title='.. k .. '}}</nowiki></code>{{红色警戒TOP|title='.. k .. '}}|div}}' end button = button .. '}}' local print = button .. content return wikitext(print) end return p