Vorlage für die Erstellung des NFL-Playoff-Baumes. Die Vorlage ist geeignet für die Saisons ab 1990.
local function sbNr(season)
local nr = tonumber(season - 1965)
local sb = ''
local roman = require('Modul:FormatNum').roman
if nr == 50 then
sb = '50'
elseif nr > 0 and nr < 100 then
local fr = {}
fr.args = {nr, ''}
sb = roman(fr)
end
return sb
end
local tp = require('Modul:Turnierplan')
local yn = require('Modul:Yesno')
local function confBranch(cKey, color, teams, args)
for i = 1, teams do
local key = cKey .. i
if args[key] == nil then
args[key] = ''
else
key = args[key]
end
args['n' .. i] = key
args['seed_' .. key] = i
end
args.runden = 3
local branch = tp.buildBracket(args)
branch.footer = {}
branch.footer.text = cKey .. 'FC Championship'
branch.footer.style = 'color:#' .. color .. '; font-weight:bold; text-align:center;'
if branch.seed ~= nil then branch.seed = cKey .. branch.seed end
return branch
end
local function seedCols(c, n, color, args)
local key = c .. n
local ret = '|style="background:#' .. color .. '| '
if args[key] ~= nil and args[key] ~= '' then
local team = args[key]
key = team
if args[team .. '_l'] ~= nil then
team = '[[' .. args[team .. '_l'] .. ']]'
elseif args[team] ~= nil then
team = args[team]
end
ret = ret .. team
end
ret = ret .. '\n|style="background:#' .. color .. '| '
if args[key .. '_div'] ~= nil then
if n <= 4 then
ret = ret .. 'Sieger [[' .. c .. 'FC ' .. args[key .. '_div'] .. '|' .. args[key .. '_div'] .. ']]'
else
ret = ret .. args[key .. '_div']
end
end
return ret .. '\n'
end
local function seedRow(n, args)
ret = '|-\n!style="background:#F8F9FA"| ' .. n .. '\n'
ret = ret .. seedCols('A', n, 'FFCCCC', args) .. seedCols('N', n, 'D0E7FF', args)
return ret
end
local function nflSeeding(args, count)
local ret = '<div style="padding-bottom:2.5ex">\n{| class="wikitable"\n|-\n!colspan="5" style="background:#F8F9FA"| Setzliste der Playoffs\n'
ret = ret .. '|-\n!class="explain" title="Position"| Pos.\n'
ret = ret .. '!colspan="2" style="background:#800000"| [[American Football Conference|<span style="color:white">AFC</span>]]\n'
ret = ret .. '!colspan="2" style="background:#000080"| [[National Football Conference|<span style="color:white">NFC</span>]]\n'
for i = 1, count do
ret = ret .. seedRow(i, args)
end
ret = ret .. '\n|}</div>\n'
return ret
end
local function nflBracket(args, season, count)
args['header-style'] = 'font-size:90%; vertical-align:bottom; padding:.2ex .5em .2ex .5em'
args.reseed = true
local switch = 0
if season ~= nil then
switch = math.fmod(season, 2)
end
local b0 = confBranch('N', '000080', count, args)
local b1 = confBranch('A', '800000', count, args)
if switch == 1 then b0, b1 = b1, b0 end
local bracket = tp.branchesToBracket(b0, b1, args)
bracket.footer = {}
bracket.footer.style = 'font-weight:bold; text-align:center;'
bracket.footer.text = 'Super Bowl'
if season ~= nil then
bracket.footer.text = 'Super Bowl ' .. sbNr(season)
end
if args.SBh ~= nil then
bracket.header = {}
bracket.header.style = args['header-style']
bracket.header.text = args.SBh
end
args.runden = args.runden +1
args.rd1 = 'Wild Card Round'
args.rd2 = 'Divisional Round'
args.rd3 = 'Conference Championships'
args.rd4 = 'Super Bowl'
tp.processArgs(args)
local ret = tp.bracketToTable(bracket)
ret = ret .. tp.footnoteTable()
return ret
end
local p = {}
function p.bracket(frame)
local ret = ''
local count = 7
if frame.args.saison ~= nil then
if tonumber(frame.args.saison) < 1978 then count = 4
elseif tonumber(frame.args.saison) < 1990 then count = 5
elseif tonumber(frame.args.saison) < 2020 then count = 6
end
end
if yn(frame.args.seeds) then
ret = nflSeeding(frame.args, count) .. '\n'
end
return ret .. nflBracket(frame.args, frame.args.saison, count)
end
return p