Lompat ke isi

Modul:Tennis events nav

Dari Wikipedia bahasa Indonesia, ensiklopedia bebas

-- This module implements [[Templat:Infobox tennis tournament event]].
-- [SublimeLinter luacheck-globals:mw]

local p = {}
local getBuffer, print = require("Module:OutputBuffer")()

local STYLES = {
	["singlesdoubles"] = {[=[|-
| [[{prefix} {tournament} {year} – Tunggal|Tunggal]]
| [[{prefix} {tournamentd} {year} – Ganda|Ganda]]]=]},
		["1"] = "singlesdoubles",
		["men"] = "singlesdoubles",
		["mens"] = "singlesdoubles",
		["women"] = "singlesdoubles",
		["womens"] = "singlesdoubles",
	["risingstarsinvitational"] = {[=[|-
| [[{prefix} {tournament} {year} – Tunggal|Tunggal]]
| [[{prefix} {tournamentd} {year} – Ganda|Ganda]]
|-
| colspan="2" | [[{prefix} {tournament} {year} – Rising Stars Invitational|Rising Stars]]]=]},
	["boysgirlssingles"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Tunggal
| [[{prefix} {tournament} {year} – Tunggal Putra|putra]]
| [[{prefix} {tournament} {year} – Tunggal Putri|putri]]
| [[{prefix} {tournament} {year} – Tunggal (remaja putra)|remaja putra]]
| [[{prefix} {tournament} {year} – Tunggal (remaja putri)|remaja putri]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Ganda
| [[{prefix} {tournament} {year} – Ganda Putra|putra]]
| [[{prefix} {tournament} {year} – Ganda Putri|putri]]]=]},
		["miamimasters"] = "boysgirlssingles",
	["mixeddoubles"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Tunggal
| [[{prefix} {tournament} {year} – Tunggal Putra|putra]]
| [[{prefix} {tournament} {year} – Tunggal Putri|putri]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Ganda
| [[{prefix} {tournament} {year} – Ganda Putra|putra]]
| [[{prefix} {tournament} {year} – Ganda Putri|putri]]
| [[{prefix} {tournament} {year} – Ganda Campuran|campuran]]]=]},
		["mixed"] = "mixeddoubles",
		["grandslam"] = "mixeddoubles",
	["mixedandteam"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Tunggal
| [[{prefix} {tournament} {year} – Tunggal Putra|putra]]
| [[{prefix} {tournament} {year} – Tunggal Putri|putri]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Ganda
| [[{prefix} {tournament} {year} – Ganda Putra|putra]]
| [[{prefix} {tournament} {year} – Ganda Putri|putri]]
| [[{prefix} {tournament} {year} – Ganda Campuran|campuran]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Tim
| [[{prefix} {tournament} {year} – Tim Putra|putra]]
| [[{prefix} {tournament} {year} – Tim Putri|putri]]]=]},
	["australianopen"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Tunggal
| [[{tournament} {year} – Tunggal Putra|putra]]
| [[{tournament} {year} – Tunggal Putri|putri]]
|
| [[{tournament} {year} – Tunggal Remaja putra|remaja putra]]
| [[{tournament} {year} – Tunggal Remaja putri|remaja putri]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Ganda
| [[{tournament} {year} – Ganda Putra|putra]]
| [[{tournament} {year} – Ganda Putri|putri]]
| [[{tournament} {year} – Ganda Campuran|campuran]]
| [[{tournament} {year} – Boys' Ganda|boys]]
| [[{tournament} {year} – Girls' Ganda|girls]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Legends
| [[{tournament} {year} – Men Legends' Ganda|men]]
| [[{tournament} {year} – Women Legends' Ganda|women]]
| [[{tournament} {year} – Legends Mixed|mixed]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | WC Tunggal
| [[{tournament} {year} – Wheelchair Tunggal Putra|men]]
| [[{tournament} {year} – Wheelchair Tunggal Putri|women]]
| [[{tournament} {year} – Wheelchair Quad Tunggal|quad]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | WC Ganda
| [[{tournament} {year} – Wheelchair Ganda Putra|men]]
| [[{tournament} {year} – Wheelchair Ganda Putri|women]]
| [[{tournament} {year} – Wheelchair Quad Ganda|quad]]
]=]},
	["frenchopen"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Tunggal
| [[{tournament} {year} – Tunggal Putra|men]]
| [[{tournament} {year} – Tunggal Putri|women]]
|
| [[{tournament} {year} – Boys' Tunggal|boys]]
| [[{tournament} {year} – Girls' Tunggal|girls]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Ganda
| [[{tournament} {year} – Ganda Putra|men]]
| [[{tournament} {year} – Ganda Putri|women]]
| [[{tournament} {year} – Ganda Campuran|mixed]]
| [[{tournament} {year} – Boys' Ganda|boys]]
| [[{tournament} {year} – Girls' Ganda|girls]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Legends
| [[{tournament} {year} – Legends Under 45 Ganda|−45]]
| [[{tournament} {year} – Legends Over 45 Ganda|45+]]
| [[{tournament} {year} – Women's Legends Ganda|women]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | WC Tunggal
| [[{tournament} {year} – Wheelchair Tunggal Putra|men]]
| [[{tournament} {year} – Wheelchair Tunggal Putri|women]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | WC Ganda
| [[{tournament} {year} – Wheelchair Ganda Putra|men]]
| [[{tournament} {year} – Wheelchair Ganda Putri|women]]
]=]},
	["wimbledonchampionships"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Tunggal
| [[{tournament} {year} – Tunggal Putra|men]]
| [[{tournament} {year} – Tunggal Putri|women]]
|
| [[{tournament} {year} – Boys' Tunggal|boys]]
| [[{tournament} {year} – Girls' Tunggal|girls]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Ganda
| [[{tournament} {year} – Ganda Putra|men]]
| [[{tournament} {year} – Ganda Putri|women]]
| [[{tournament} {year} – Ganda Campuran|mixed]]
| [[{tournament} {year} – Boys' Ganda|boys]]
| [[{tournament} {year} – Girls' Ganda|girls]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Legends
| [[{tournament} {year} – Gentlemen's Invitation Ganda|men]]
| [[{tournament} {year} – Ladies' Invitation Ganda|women]]
| [[{tournament} {year} – Senior Gentlemen's Invitation Ganda|seniors]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | WC Ganda
| [[{tournament} {year} – Wheelchair Ganda Putra|men]]
| [[{tournament} {year} – Wheelchair Ganda Putri|women]]
]=]},
	["usopen"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Tunggal
| [[{tournament} {year} – Tunggal Putra|men]]
| [[{tournament} {year} – Tunggal Putri|women]]
|
| [[{tournament} {year} – Boys' Tunggal|boys]]
| [[{tournament} {year} – Girls' Tunggal|girls]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Ganda
| [[{tournament} {year} – Ganda Putra|men]]
| [[{tournament} {year} – Ganda Putri|women]]
| [[{tournament} {year} – Ganda Campuran|mixed]]
| [[{tournament} {year} – Boys' Ganda|boys]]
| [[{tournament} {year} – Girls' Ganda|girls]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Legends
| [[{tournament} {year} – Men's Champions Invitational|men]]
| [[{tournament} {year} – Women's Champions Invitational|women]]
| [[{tournament} {year} – Mixed Champions Invitational|mixed]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | WC Tunggal
| [[{tournament} {year} – Wheelchair Tunggal Putra|men]]
| [[{tournament} {year} – Wheelchair Tunggal Putri|women]]
| [[{tournament} {year} – Wheelchair Quad Tunggal|quad]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | WC Ganda
| [[{tournament} {year} – Wheelchair Ganda Putra|men]]
| [[{tournament} {year} – Wheelchair Ganda Putri|women]]
| [[{tournament} {year} – Wheelchair Quad Ganda|quad]]
]=]},
	["abnamroworldtennistournament"] = {[=[|-
| [[{prefix} {tournament} {year} – Tunggal|Tunggal]]
| [[{prefix} {tournamentd} {year} – Ganda|Ganda]]
|-
| [[{prefix} {tournament} {year} – Wheelchair Tunggal|wheelchair Tunggal]]
| [[{prefix} {tournamentd} {year} – Wheelchair Ganda|wheelchair Ganda]]]=]},
	["Gandatwotourneys"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Tunggal
| [[{prefix} {tournament} {year} – Tunggal|putra]]
| [[{prefix} {tournamentd} {year} – Tunggal|putri]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Ganda
| [[{prefix} {tournament} {year} – Ganda|putra]]
| [[{prefix} {tournamentd} {year} – Ganda|putri]]]=]},
	[""] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Tunggal
| [[{prefix} {tournament} {year} – Tunggal Putra|putra]]
| [[{prefix} {tournament} {year} – Tunggal Putri|putri]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Ganda
| [[{prefix} {tournament} {year} – Ganda Putra|putra]]
| [[{prefix} {tournament} {year} – Ganda Putri|putri]]]=]}}

local function pullItem(value, default)
	value = value and string.lower(string.gsub(value, "%A", ""))
	if type(STYLES[value]) == "string" then
		value = STYLES[value]
	end
	if STYLES[value] then
		return STYLES[value][1]
	else
		return STYLES[default][1]
	end
end

function p._main(args)
	local default = ""
	if args[2] ~= args[3] then
		default = "Gandatwotourneys"
	end

	print('{| style="border-spacing: 0.6em 0; margin: auto; ' ..
		  'text-align: center;"')
	print(string.gsub(pullItem(args.type, default), "{(%a+)}",
		{prefix = args.prefix or "", year = args[1], tournament = args[2],
		 tournamentd = args[3]}))
	print("|}")
	return getBuffer("\n")
end

function p.main(frame)
	local args = require("Module:Arguments").getArgs(frame)
	return p._main(args)
end

return p