local pp =
local basketball_positions = local status_called =
-- Roster formatfunction pp.headings(args, keys) local h = mw.html.create('tr') if keys['pos'] then h:tag('th'):tag('abbr'):attr('title', 'Position'):wikitext('Pos.') end if keys['num'] then h:tag('th'):tag('abbr'):attr('title', 'Number'):wikitext('No.') end if keys['nat'] then h:tag('th'):tag('abbr'):attr('title', 'Nationality'):wikitext('Nat.') end h:tag('th'):wikitext('Name') if keys['sg'] then h:tag('th'):tag('abbr'):attr('title', 'Shot/Glove'):wikitext('S/G') end if keys['ft'] or keys['in'] then h:tag('th'):wikitext('Height') end if keys['lbs'] then h:tag('th'):wikitext('Weight') end if keys['DOB'] or keys['birthyear'] then h:tag('th'):tag('abbr'):attr('title', 'Date of birth'):wikitext('DOB') end if keys['acq'] then h:tag('th'):wikitext('Acquired') end if keys['college'] or keys['school'] or keys['from'] or keys['birthplace'] then h:tag('th'):wikitext('From') end if keys['yrs'] then h:tag('th'):tag('abbr'):attr('title', 'Years'):wikitext('Yrs') end return tostring(h)end
function pp.players_roster(args, players, keys, frame) local tracking = local res = mw.html.create() for k,v in ipairs(players) do local r = res:tag('tr'):css('text-align', 'center') if keys['pos'] then local pos = v['pos'] if args['sport']
'yes' then name_string = name_string .. ' ' end if v['note'] then name_string = name_string .. ' ' .. "(" .. v['note'] .. ")" end -- Insert status when needed local status_string = local status_local = v['note'] or nil local strTwo = require('Module:String2') local status_let_first = true -- Only if it is defined if status_local then local status_list = mw.text.split(status_local, ",") for i, s in ipairs(status_list) do if status_let_first then status_string = s table.insert(status_called, s) status_let_first = false else status_string = status_string..', '..s table.insert(status_called, s) end -- end end if not status_let_first then status_string = '
('..status_string..')' end end r:tag('td'):css('text-align', 'left'):wikitext(name_string) if keys['sg'] then local sg = v['sg'] or r:tag('td'):wikitext(sg) end if keys['ft'] or keys['in'] then local h = if v['ft'] and tonumber(v['ft']) then local inches = 12*tonumber(v['ft']) + (tonumber(v['in']) or 0) local cm = math.floor(2.54*inches + 0.5) h = '' .. tonumber(v['ft']) .. '\' ' .. (tonumber(v['in']) or 0) .. '"' .. ' (' .. (cm / 100) .. 'm)' end r:tag('td') :css('text-align', 'right') :css('white-space', 'nowrap') :wikitext(h) end if keys['lbs'] then local w = if v['lbs'] and tonumber(v['lbs']) then local kg = math.floor(0.45359237*tonumber(v['lbs']) + 0.5) w = tonumber(v['lbs']) .. ' lb ' .. ' (' .. kg .. 'kg)' end r:tag('td') :css('text-align', 'right') :css('white-space', 'nowrap') :wikitext(w) end if keys['birthyear'] then local DOB = v['birthyear'].."-"..v['birthmonth'].."-"..v['birthday'] or DOB = mw.ustring.gsub(DOB, '^%s*(%d)%-(%d%d?)%-(%d%d%d%d)%s*$', '0%1-%2-%3') DOB = mw.ustring.gsub(DOB, '^%s*(%d%d?)%-(%d)%-(%d%d%d%d)%s*$', '%1-0%2-%3') DOB = mw.ustring.gsub(DOB, '^%s*(%d%d)%-(%d%d)%-(%d%d%d%d)%s*$', '%3-%1-%2') DOB = mw.ustring.gsub(DOB, '^%s*(%d%d%d%d)%-(%d)%-(%d%d?)%s*$', '%1-0%2-%3') DOB = mw.ustring.gsub(DOB, '^%s*(%d%d%d%d)%-(%d%d?)%-(%d)%s*$', '%1-%2-0%3') local age = frame:expandTemplate DOB = DOB..' (age '..age..')' r:tag('td'):wikitext(DOB) endif keys['DOB'] then local DOB = v['DOB'] or DOB = mw.ustring.gsub(DOB, '^%s*(%d)%-(%d%d?)%-(%d%d%d%d)%s*$', '0%1-%2-%3') DOB = mw.ustring.gsub(DOB, '^%s*(%d%d?)%-(%d)%-(%d%d%d%d)%s*$', '%1-0%2-%3') DOB = mw.ustring.gsub(DOB, '^%s*(%d%d)%-(%d%d)%-(%d%d%d%d)%s*$', '%3-%1-%2') DOB = mw.ustring.gsub(DOB, '^%s*(%d%d%d%d)%-(%d)%-(%d%d?)%s*$', '%1-0%2-%3') DOB = mw.ustring.gsub(DOB, '^%s*(%d%d%d%d)%-(%d%d?)%-(%d)%s*$', '%1-%2-0%3') local age = frame:expandTemplate DOB = DOB..' (age '..age..')' r:tag('td'):wikitext(DOB) end if keys['acq'] then r:tag('td'):wikitext(v['acq']) end if keys['college'] or keys['school'] or keys['from'] or keys['birthplace'] then if v['college'] or v['school'] then r:tag('td'):css('text-align', 'left'):wikitext(v['college'] or v['school']) elseif v['from'] then r:tag('td'):css('text-align', 'left'):wikitext('' .. v['from'] .. '') elseif v['birthplace'] then r:tag('td'):css('text-align', 'left'):wikitext(v['birthplace']) else r:tag('td') end end if keys['yrs'] then if v['yrs']
function pp.coaches_roster(coaches) local res = local role = for k,v in ipairs(coaches) do if v['role'] ~= role then role = v['role'] res = res .. '\n; ' .. role end res = res .. '\n: ' .. (v['nat'] or ) .. ' ' .. (v['name'] or ) if v['note'] then res = res .. ' ' .. "(" .. v['note'] .. ")" end if v['college'] then res = res .. ' (' .. v['college'] .. ')' elseif v['from'] then res = res .. ' (' .. v['from'] .. ')' end end return resend
function pp.staff_roster(staff) local res = local role = for k,v in ipairs(staff) do if v['role'] ~= role then role = v['role'] res = res .. '\n; ' .. role end res = res .. '\n: ' .. (v['nat'] or ) .. ' ' .. (v['name'] or ) if v['college'] then res = res .. ' (' .. v['college'] .. ')' elseif v['from'] then res = res .. ' (' .. v['from'] .. ')' end end return resend
function pp.legend(args) local status_code = status_code = local status_letters = (args['status_order'] or ) .. 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' for l in mw.text.gsplit(status_letters, ) do status_called[l] = false status_code[l] = status_code[l] or '?' status_letters = mw.ustring.gsub(status_letters, '(' .. l ..'.-)' .. l, '%1')
if args['status_text_' .. l] then status_code[l] = args['status_text_' .. l] end end -- Now for the named status local status_exist = false local status_string = local curr_status for k,v in ipairs(status_called) do status_string = status_string..'
('..v..') '..status_code['T']..'; ' status_exist = true end local res = '\n----' res = res .. '\n;Legend\n'.. status_string for k,v in ipairs do res = res .. "\n*(" .. v[1] .. ") " .. v[2] end if args['otherlegend'] then res = res .. '\n*' .. args['otherlegend'] end if args['otherlegend2'] then res = res .. '\n*' .. args['otherlegend2'] end if args['otherlegend3'] then res = res .. '\n*' .. args['otherlegend3'] end res = res .. '\n* Injured' local team = args['rosterteam'] if not team then team = string.lower(args['team']) team = mw.ustring.gsub(team, '^.*%s(%S+)%s*$', '%1') end if args['update'] then res = res .. '\n----\n Updated to transactions as of ' .. args['update'] .. '.' end if team and not args['update'] then res = res .. '\n----\n .. team .. '/roster Roster' elseif team then if args['source'] then res = res .. '\n Source: ' .. args['source'] else res = res .. '\n .. team .. '/roster Roster' end end if args['notes'] then res = res .. ';Notes\n' .. args['notes'] end return resendfunction pp.above(args, keys) return '' .. args['team'] .. ' roster'end
function pp.abovestyle(frame, args, keys) local sportscolor = require('Module:Sports color') return sportscolor.colorcellend
function pp.headingstyle(frame, args, keys) local sportscolor = require('Module:Sports color') return sportscolor.colorcell2end
function pp.footer(args, keys) return ""end
function pp.footerstyle(frame, args, keys) return 'border:1px #aaa solid;'end
-- Navbox format
function pp.players_list(args, players, keys) local r = for k,v in ipairs(players) do r = r .. '\n*' .. (v['num'] or ) .. ' ' .. (v['name'] or ) end return rend
function pp.coaches_list(coaches) local res = local role = for k,v in ipairs(coaches) do if v['role'] ~= role then role = v['role'] res = res .. '\n; ' .. role end res = res .. '\n: ' .. (v['name'] or ) end return resend
function pp.title(args, keys) return '' .. args['team'] .. ' current roster'end
function pp.titlestyle(frame, args, keys) local sportscolor = require('Module:Sports color') return sportscolor.colorcellend
function pp.below(args, keys) return pp.footer(args, keys)end
function pp.belowstyle(frame, args, keys) return 'background:transparent; border-top:1px #aaa solid;'end
return pp