置顶公告:【置顶】关于临时开启评论区所有功能的公告(2022.10.22) | 【置顶】关于本站Widget恢复使用的公告
  • 你好~!欢迎来到萌娘百科镜像站!如需查看或编辑,请联系本站管理员注册账号。
  • 本镜像站和其他萌娘百科的镜像站无关,请注意分别。

Module:红色警戒TOP

猛汉♂百科,万男皆可猛的百科全书!转载请标注来源页面的网页链接,并声明引自猛汉百科。内容不可商用。
跳到导航 跳到搜索
Template-info.svg 模块文档  [创建] [刷新]
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