-- this module implements -- -- -- local p =
local afbpositions = require('Module:American football positions')._mainlocal yesno = require('Module:Yesno')
local row_colors =
local doubledagger = ""
local function anchor(value) if value and value ~= then return '
' end return endlocal function sortname(first, last, link, nolink) last = last or first = first or link = link or local name = first .. ' ' .. last if not (nolink or (first
'-')) then if link ~= then name = '' .. name .. '' else name = '' .. name .. '' end end name = '
' .. name .. '' return '" .. name .. ''endlocal function get_round_color(round, numrounds) -- make sure numbers are within bounds round = tonumber(round) or -1 numrounds = tonumber(numrounds) or 7 numrounds = numrounds < 7 and 7 or numrounds numrounds = numrounds > 32 and 32 or numrounds -- linear color scale from F00 to F0A local c = -- affine map from [1, numrounds] to [1, #c] local r = math.floor(1.5 + (round - 1) * (#c - 1) / (numrounds - 1)) return c[r] or "fff"end
function p._row(args) local rowtype = 'none' for k,v in ipairs do if yesno(v) then rowtype = v end end local rowcolor = row_colors[rowtype] local root = local txt = table.insert(root,'|-' .. (rowcolor and 'style="background:#' .. rowcolor .. '"' or )) if not yesno(args['undrafted']) then local pickstyle = 'text-align:center;' table.insert(root,'|style="background:#' .. get_round_color(args['round'], args['numberofrounds']) .. '"|') txt = (args['round'] or '') if yesno(args['firstpickinround']) then txt = txt .. anchor('Round_' .. (args['round'] or )) end if yesno(args['compensatory']) then txt = '|style="text-align:center;font-weight:bold;"| ' .. txt .. '*' pickstyle = pickstyle .. 'background-color:unset;' elseif yesno(args['supplemental']) then txt = '|style="text-align:center;font-weight:bold;"| ' .. txt .. '^' pickstyle = pickstyle .. 'background-color:unset;' elseif yesno(args['expansion']) then txt = '|style="text-align:center;font-weight:bold;"| ' .. txt .. '¤' pickstyle = pickstyle .. 'background-color:unset;' elseif yesno(args['resolution']) then txt = '|style="text-align:center;font-weight:bold;"| ' .. txt .. '×' pickstyle = pickstyle .. 'background-color:unset;' else txt = '! ' .. txt end table.insert(root,txt) txt = args['picknum'] or '' if tonumber(txt)
2 then txt = '1' elseif yesno(args['lastpick']) then txt = '' .. txt '' end txt = anchor('Pick_' .. (args['picknum'] or )) .. txt table.insert(root,'!scope=row style="font-weight:bold;' .. pickstyle .. '"|' .. txt) end txt = args['team'] or '' if args['draftyear'] then txt = '' .. txt .. '' elseif args['teamdab'] then txt = '' .. args['team'] .. '' end table.insert(root,'| ' .. txt) txt = if args['last'] then local style = local name = sortname(args['first'], args['last'], args['dab'], (args['playerpageexists']
local function abbr(a, d) return '' .. a .. ''end
function p._header(args) local root =
local style = 'scope=col style="background:#A8BDEC;%s"' table.insert(root, '
\n-') local cstyle = string.format(style,'width:3px;') local pstyle = string.format(style, ) local nstyle = string.format(style, args['noteswidth'] and 'width:' .. args['noteswidth'] .. ';' or ) local oteam if not yesno(args['undrafted']) then table.insert(root, '! ' .. cstyle .. ' class="unsortable" | ') table.insert(root, '! ' .. pstyle .. ' | ' .. abbr('Rnd.', 'Draft round')) table.insert(root, '! ' .. pstyle .. ' | ' .. abbr('Pick No.', 'Overall selection number')) oteam = abbr('NFL team', 'Team which made selection') else oteam = abbr('Original NFL team', 'Team which signed the player after the draft') end table.insert(root, '! ' .. pstyle .. ' | ' .. oteam) table.insert(root, '! ' .. pstyle .. ' | Player') table.insert(root, '! ' .. pstyle .. ' | ' .. abbr('Pos.', 'Football position played')) table.insert(root, '! ' .. pstyle .. ' | ' .. abbr('College', 'Most recent college attended')) table.insert(root, '! ' .. pstyle .. ' | ' .. abbr('Conf.', 'Athletic conference of most recent college')) table.insert(root, '! ' .. nstyle .. ' class="unsortable" | Notes') table.insert(root, ' | -') return table.concat(root, '\n')end function p._footer return ' | -\n |
function p.row(frame) local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame) return p._row(args)end
function p.header(frame) local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame) return p._header(args)end
function p.footer(frame) return p._footerend
return p