Module:Bracket/sandbox

local p = {}

local teamBracket = require('Module:Team bracket').main

function p._teamBracket(frame, template, subs, defs) args = {} -- assign defaults for k, v in pairs(defs) do		args[k] = v	end -- figure out parameters from template name teams = mw.ustring.match(template or '', "^(%d*)Team") if not teams then teams = mw.ustring.match(template or '', "^(%d*)Round") elseif teams == "4" then args.rounds = args.rounds or 2 elseif teams == "8" then args.rounds = args.rounds or 3 elseif teams == "16" then args.rounds = args.rounds or 4 end tennis = mw.ustring.match(template or '', "-Tennis(%d*)") if tennis then args.sets = args.sets or tennis args.seeds = args.seeds or 'yes' args.nowrap = args.nowrap or 'yes' end if string.find(template, "-Compact") then args.compact = args.compact or 'yes' end -- get args and alternative args for k, v in pairs(frame:getParent.args) do		if subs[k] then args[subs[k]] = v		else args[k] = v		end end --return template return require('Module:Team bracket').main(frame:newChild{title = ("Template:" .. template), args = outargs}) end

function p.FourTeamBracket(frame) return p._teamBracket(frame, '4TeamBracket', {		group1 = "RD1-group1"	}, {		autoseeds = "y",		['RD1-group1'] = ""	}) end p['4TeamBracket'] = p.FourTeamBracket

function p.FourTeamBracketTennis3(frame) return p._teamBracket(frame, '4TeamBracket-Tennis3', {}, {		RD2 = "Final",		['team-width'] = 125	}) end p['4TeamBracket-Tennis3'] = p.FourTeamBracketTennis3

function p.FourTeamBracketTennis5(frame) return p._teamBracket(frame, '4TeamBracket-Tennis5', {}, {		seeds = ,		RD1 = "Quarterfinals",		RD2 = "Semifinals",		['team-width'] = 125,		['RD1-seed1'] = ,		['RD1-seed2'] = ,		['RD1-seed3'] = ,		['RD1-seed4'] = '',	}) end p['4TeamBracket-Tennis5'] = p.FourTeamBracketTennis5

function p.FourTeamBracketTennis35(frame) return p._teamBracket(frame, '4TeamBracket-Tennis35', {}, {		sets = "3/5",		RD1 = "Semifinals",		RD2 = "Final",		['RD1-seed1'] = ,		['RD1-seed2'] = ,		['RD1-seed3'] = ,		['RD1-seed4'] = ,	}) end p['4TeamBracket-Tennis35'] = p.FourTeamBracketTennis35

function p.EightTeamBracket(frame) return p._teamBracket(frame, '8TeamBracket', {		group1 = 'RD1-group1',		group2 = 'RD1-group2',		group3 = 'RD2-group1',		['RD1-seed01'] = 'RD1-seed1',		['RD1-seed02'] = 'RD1-seed2',		['RD1-seed03'] = 'RD1-seed3',		['RD1-seed04'] = 'RD1-seed4',		['RD1-seed05'] = 'RD1-seed5',		['RD1-seed06'] = 'RD1-seed6',		['RD1-seed07'] = 'RD1-seed7',		['RD1-seed08'] = 'RD1-seed8',	}, {		['RD1-seed1'] = 1,		['RD1-seed2'] = 8,		['RD1-seed3'] = 4,		['RD1-seed4'] = 5,		['RD1-seed5'] = 2,		['RD1-seed6'] = 7,		['RD1-seed7'] = 3,		['RD1-seed8'] = 6,	}) end p['8TeamBracket'] = p.EightTeamBracket

function p.EightTeamBracketByes(frame) return p._teamBracket(frame, '8TeamBracket-Byes', {		group1 = "RD1-group1",		group2 = "RD1-group2",		group3 = "RD2-group1",		Consol = "RD3b"	}, {		seeds = 'yes',		byes = 1,		['team-width'] = '11em',		['score-width'] = '2em',		['RD1-group1'] = ,		['RD1-group2'] = ,		['RD2-group1'] = '',		RD3b = frame:getParent.args['RD3-team3'] and "Third place" or ""	}) end p['3RoundBracket-Byes'] = p.EightTeamBracketByes p['8TeamBracket-Byes'] = p.EightTeamBracketByes

function p.EightTeamBracketTennis3(frame) return p._teamBracket(frame, '8TeamBracket-Tennis3', {}, {		RD1 = 'Quarterfinals',		RD2 = 'Semifinals',		RD3 = 'Final',		['team-width'] = 140,		['RD1-seed1'] = 1,		['RD1-seed2'] = 8,		['RD1-seed3'] = 4,		['RD1-seed4'] = 5,		['RD1-seed5'] = 3,		['RD1-seed6'] = 6,		['RD1-seed7'] = 2,		['RD1-seed8'] = 7,	}) end p['8TeamBracket-Tennis3'] = p.EightTeamBracketTennis3

function p.EightTeamBracketTennis5(frame) return p._teamBracket(frame, '8TeamBracket-Tennis5', {}, {		RD1 = 'Quarterfinals',		RD2 = 'Semifinals',		RD3 = 'Final',	}) end p['8TeamBracket-Tennis5'] = p.EightTeamBracketTennis5

function p.SixteenTeamBracket(frame) return p._teamBracket(frame, '16TeamBracket', {		subgroup1 = 'RD1-group1',		subgroup2 = 'RD1-group2',		subgroup3 = 'RD1-group3',		subgroup4 = 'RD1-group4',		group1 = 'RD2-group1',		group2 = 'RD2-group2',		group3 = 'RD3-group1',		['RD1-seed01'] = 'RD1-seed1',		['RD1-seed02'] = 'RD1-seed2',		['RD1-seed03'] = 'RD1-seed3',		['RD1-seed04'] = 'RD1-seed4',		['RD1-seed05'] = 'RD1-seed5',		['RD1-seed06'] = 'RD1-seed6',		['RD1-seed07'] = 'RD1-seed7',		['RD1-seed08'] = 'RD1-seed8',		['RD1-seed09'] = 'RD1-seed9',	}, {		['RD1-seed1'] = 1,		['RD1-seed2'] = 16,		['RD1-seed3'] = 8,		['RD1-seed4'] = 9,		['RD1-seed5'] = 5,		['RD1-seed6'] = 12,		['RD1-seed7'] = 4,		['RD1-seed8'] = 13,		['RD1-seed9'] = 6,		['RD1-seed10'] = 11,		['RD1-seed11'] = 3,		['RD1-seed12'] = 14,		['RD1-seed13'] = 7,		['RD1-seed14'] = 10,		['RD1-seed15'] = 2,		['RD1-seed16'] = 15,	}) end p['16TeamBracket'] = p.SixteenTeamBracket

function p.SixteenTeamBracketByes(frame) return p._teamBracket(frame, '16TeamBracket-Byes', {		group1 = "RD1-group1",		group2 = "RD2-group2",	}, {		seeds = 'yes',		byes = 1,		RD1 = 'First round',		RD2 = 'Second round',		RD3 = 'Semifinals',		RD4 = 'Final',		['team-width'] = '11em',		['score-width'] = '2em',		['RD1-group1'] = ,		['RD2-group2'] = ,	}) end p['4RoundBracket-Byes'] = p.SixteenTeamBracketByes p['16TeamBracket-Byes'] = p.SixteenTeamBracketByes

function p.SixteenTeamBracketTennis3(frame) return p._teamBracket(frame, '16TeamBracket-Tennis3', {}, {		['team-width'] = 140,		['score-width'] = 25,		RD1 = 'First round',		RD2 = 'Quarterfinals',		RD3 = 'Semifinals',		RD4 = 'Final',	}) end p['16TeamBracket-Tennis3'] = p.SixteenTeamBracketTennis3

function p.SixteenTeamBracketCompactTennis3(frame) return p._teamBracket(frame, '16TeamBracket-Compact-Tennis3', {}, {		RD1 = '1st round',		RD2 = '2nd round',	}) end p['16TeamBracket-Compact-Tennis3'] = p.SixteenTeamBracketCompactTennis3

function p.SixteenTeamBracketCompactTennis3Byes(frame) return p._teamBracket(frame, '16TeamBracket-Compact-Tennis3-Byes', {}, {		byes = 2,		['seed-width'] = 25,		['team-width'] = 150,		RD1 = '1st round',		RD2 = '2nd round',		RD3 = 'Semifinals',		RD4 = 'Final',	}) end p['16TeamBracket-Compact-Tennis3-Byes'] = p.SixteenTeamBracketCompactTennis3Byes p['4RoundBracket-Compact-Tennis3-Byes'] = p.SixteenTeamBracketCompactTennis3Byes

function p.SixteenTeamBracketTennis5(frame) return p._teamBracket(frame, '16TeamBracket-Tennis5', {}, {		RD1 = 'First round',		RD2 = 'Quarterfinals',		RD3 = 'Semifinals',		RD4 = 'Final',		['seed-width'] = 25,		['team-width'] = 150,		['score-width'] = 12,	}) end p['16TeamBracket-Tennis5'] = p.SixteenTeamBracketTennis5

function p.SixteenTeamBracketCompactTennis5(frame) return p._teamBracket(frame, '16TeamBracket-Compact-Tennis5', {}, {		RD1 = 'First round',		RD2 = 'Second round',		RD3 = 'Third round',		RD4 = 'Fourth round',	}) end p['16TeamBracket-Compact-Tennis5'] = p.SixteenTeamBracketCompactTennis5

function p.SixteenTeamBracketCompactTennis5Byes(frame) return p._teamBracket(frame, '16TeamBracket-Compact-Tennis5-Byes', {}, {		byes = 1,		RD1 = 'First round',		RD2 = 'Second round',		RD3 = 'Semifinals',		RD4 = 'Final',	}) end p['16TeamBracket-Compact-Tennis5-Byes'] = p.SixteenTeamBracketCompactTennis5Byes p['4RoundBracket-Compact-Tennis5-Byes'] = p.SixteenTeamBracketCompactTennis5Byes

return p