Module:Trn

From SmashWiki, the Super Smash Bros. wiki
Revision as of 12:33, January 28, 2024 by Toomai (talk | contribs) (proof of concept)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

To edit the data of which tournaments are what rank, go to Module:Trn/data.


local default = "n"
local major = "'''n'''"
local supermajor = "'''''n'''''"

local tournaments = {
	["Beeg T"] = {["SSBM"] = major, ["SSBU"] = supermajor},
	["Smaller T"] = {["SSBM"] = default, ["SSBB"] = major},
}

local trn_formatter = {}

function trn_formatter.formatTournamentLink(frame)
	name = frame.args[1]
	disambig = frame.args[2]
	game = frame.args[3]
	if disambig == nil or disambig == "" then
		link = "[[Tournament:"..name.."|"..name.."]]"
	else
		link = "[[Tournament:"..name.." ("..disambig..")|"..name.."]]"
	end
	if game == nil or game == "" then
		fstring = default
	else
		tourney = tournaments[name]
		if tourney == nil then
			fstring = default
		else
			fstring = tourney[game]
		end
	end
	if fstring == nil or fstring == "" then
		fstring = default
	end
	result = string.gsub(fstring,"n",link)
	return result
end

return trn_formatter