Preskočiť na obsah

Modul:Tennis events nav

z Wikipédie, slobodnej encyklopédie


Túto dokumentáciu [vytvoriť] [obnoviť]
Dokumentácia Dokumentácia

Dokumentácia pre tento modul zatiaľ neexistuje. Môžete ju vytvoriť na Modul:Tennis events nav/Dokumentácia


Ak máte otázku k tomuto modulu, alebo potrebujete jeho rozšírenie a neviete ho správne naformátovať, pýtajte sa v diskusii k modulu. Pokiaľ je potrebné modul urgentne opraviť, obráťte sa na technickú podporu.

-- Tento modul bol prevzatý z anglickej wikipédie https://en.wikipedia.org/w/index.php?title=Module:Tennis_events_nav&oldid=674058714
-- This module implements [[Template:Infobox tennis tournament event/events]].
-- [SublimeLinter luacheck-globals:mw]

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

local DebugVar

local STYLES = {
	["muži"] = {[=[|-
| [[Mužská dvojhra na {tournament} {prefix} {year}|dvojhra]]
| [[Mužská štvorhra na {tournament} {prefix} {year}|štvorhra]]]=]},
	["ženy"] = {[=[|-
| [[Ženská dvojhra na {tournament} {prefix} {year}|dvojhra]]
| [[Ženská štvorhra na {tournament} {prefix} {year}|štvorhra]]]=]},
	["singlesdoubles"] = {[=[|-
| [[Dvojhra na {tournament} {prefix} {year}|dvojhra]]
| [[Štvorhra na {tournament} {prefix} {year}|štvorhra]]]=]},
		["1"] = "singlesdoubles",
		["men"] = "singlesdoubles",
		["mens"] = "singlesdoubles",
		["women"] = "singlesdoubles",
		["womens"] = "singlesdoubles",
	["risingstarsinvitational"] = {[=[|-
| [[Dvojhra na {tournament} {prefix} {year}|dvojhra]]
| [[Štvorhra na {tournament} {prefix} {year}|štvorhra]]
|-
| colspan="2" | [[{prefix} {year} {tournament} – Rising Stars Invitational|Rising Stars]]]=]},
	["boysgirlssingles"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Dvojhra
| [[Mužská dvojhra na {tournament} {prefix} {year}|muži]]
| [[Ženská dvojhra na {prefix} {tournament} {year}|ženy]]
| [[Chlapčenská dvohra na {prefix} {tournament} {year}|chlapci]]
| [[Dievčenská dvojhra na {prefix} {tournament} {year}|dievčatá]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Štvorhra
| [[Mužská štvorhra na {tournament} {prefix} {year}|muži]]
| [[Ženská štvorhra na {prefix} {tournament} {year}|ženy]]]=},
		["miamimasters"] = "boysgirlssingles",
	["mixeddoubles"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Singles
| [[{prefix} {year} {tournament} – Men's Singles|men]]
| [[{prefix} {year} {tournament} – Women's Singles|women]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Doubles
| [[{prefix} {year} {tournament} – Men's Doubles|men]]
| [[{prefix} {year} {tournament} – Women's Doubles|women]]
| [[{prefix} {year} {tournament} – Mixed Doubles|mixed]]]=]},
		["mixed"] = "mixeddoubles",
		["grandslam"] = "mixeddoubles",
	["mixedandteam"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Singles
| [[{prefix} {year} {tournament} – Men's Singles|men]]
| [[{prefix} {year} {tournament} – Women's Singles|women]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Doubles
| [[{prefix} {year} {tournament} – Men's Doubles|men]]
| [[{prefix} {year} {tournament} – Women's Doubles|women]]
| [[{prefix} {year} {tournament} – Mixed Doubles|mixed]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Team
| [[{prefix} {year} {tournament} – Men's Team|men]]
| [[{prefix} {year} {tournament} – Women's Team|women]]]=]},
	["australianopen"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Dvojhry
| [[Mužská dvojhra na {tournament} {year}|muži]]
| [[Ženská dvojhra na {tournament} {year}|ženy]]
|
| [[Chlapčenská dvojhra na {tournament} {year}|chlapci]]
| [[Dievčenská dvojhra na {tournament} {year}|dievčatá]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Štvorhry
| [[Mužská štvorhra na {tournament} {year}|muži]]
| [[Ženská štvorhra na {tournament} {year}|ženy]]
| [[Zmiešaná štvorhra na {tournament} {year}|zmiešaná]]
| [[Chlapčenská štvorhra na {tournament} {year}|chlapci]]
| [[Dievčenská štvorhra na {tournament} {year}|dievčatá]]
]=]},
	["frenchopen"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Dvojhry
| [[Mužská dvojhra na {tournament} {year}|muži]]
| [[Ženská dvojhra na {tournament} {year}|ženy]]
|
| [[Chlapčenská dvojhra na {tournament} {year}|chlapci]]
| [[Dievčenská dvojhra na {tournament} {year}|dievčatá]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Štvorhry
| [[Mužská štvorhra na {tournament} {year}|muži]]
| [[Ženská štvorhra na {tournament} {year}|ženy]]
| [[Zmiešaná štvorhra na {tournament} {year}|zmiešaná]]
| [[Chlapčenská štvorhra na {tournament} {year}|chlapci]]
| [[Dievčenská štvorhra na {tournament} {year}|dievčatá]]
]=]},
	["wimbledon"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Dvojhry
| [[Mužská dvojhra na {tournament}e {year}|muži]]
| [[Ženská dvojhra na {tournament}e {year}|ženy]]
|
| [[Chlapčenská dvojhra na {tournament}e {year}|chlapci]]
| [[Dievčenská dvojhra na {tournament}e {year}|dievčatá]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Štvorhry
| [[Mužská štvorhra na {tournament}e {year}|muži]]
| [[Ženská štvorhra na {tournament}e {year}|ženy]]
| [[Zmiešaná štvorhra na {tournament}e {year}|zmiešaná]]
| [[Chlapčenská štvorhra na {tournament}e {year}|chlapci]]
| [[Dievčenská štvorhra na {tournament}e {year}|dievčatá]]
]=]},
	["usopen"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Dvojhry
| [[Mužská dvojhra na {tournament} {year}|muži]]
| [[Ženská dvojhra na {tournament} {year}|ženy]]
|
| [[Chlapčenská dvojhra na {tournament} {year}|chlapci]]
| [[Dievčenská dvojhra na {tournament} {year}|dievčatá]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Štvorhry
| [[Mužská štvorhra na {tournament} {year}|muži]]
| [[Ženská štvorhra na {tournament} {year}|ženy]]
| [[Zmiešaná štvorhra na {tournament} {year}|zmiešaná]]
| [[Chlapčenská štvorhra na {tournament} {year}|chlapci]]
| [[Dievčenská štvorhra na {tournament} {year}|dievčatá]]
]=]},
	["abnamroworldtennistournament"] = {[=[|-
| [[{prefix} {year} {tournament} – Singles|singles]]
| [[{prefix} {year} {tournamentd} – Doubles|doubles]]
|-
| [[{prefix} {year} {tournament} – Wheelchair Singles|wheelchair singles]]
| [[{prefix} {year} {tournamentd} – Wheelchair Doubles|wheelchair doubles]]]=]},
	["loh"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Dvojhry
| [[{prefix} {tournament}  {year} – dvojhra mužov|muži]]
| [[{prefix} {tournamentd} {year} – dvojhra žien|ženy]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Štvorhry
| [[{prefix} {tournament} {year} – štvorhra mužov|muži]]
| [[{prefix} {tournamentd} {year} – štvorhra žien|ženy]]]=]},
	["doublestwotourneys"] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Dvojhry
| [[Mužská dvojhra na {tournament} {year}|muži]]
| [[Ženská dvojhra na {tournament} {year}|ženy]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Štvorhry
| [[Mužská štvorhra na {tournament} {year}|muži]]
| [[Ženská štvorhra na {tournament} {year}|ženy]]]=]},
	[""] = {[=[|-
! scope="row" style="font-weight: normal; text-align: right;" | Dvojhry
| [[Mužská dvojhra na {tournament} {year}|muži]]
| [[Ženská dvojhra na {tournament} {year}|ženy]]
|-
! scope="row" style="font-weight: normal; text-align: right;" | Štvorhry
| [[Mužská štvorhra na {tournament} {year}|muži]]
| [[Ženská štvorhra na {tournament} {year}|ženy]]]=]}}

local function pullItem(value, default)
--	DebugVar = value
	value = value and string.lower(string.gsub(value, " ", ""))
--	DebugVar = DebugVar.."+"..value
	if type(STYLES[value]) == "string" then
		value = STYLES[value]
	end
--	DebugVar = DebugVar.."+"..value
	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 = "doublestwotourneys"
	end
   
--   local prefixx = args.prefix or ""
--   local womendouble = prefixx.." "..args[2].." "..args[1].." – štvorhra žien"
--   if mw.title.new(womendouble).exists then
--		womendouble = "[["..womendouble.."|ženy]]"
--	else
--		womendouble = "ženy"
--	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