Module:NBA team standings: Difference between revisions

Content deleted Content added
test
Changed: – → ‍–‍ for home & road records to prevent line breaks
 
(11 intermediate revisions by 3 users not shown)
Line 17:
 
local highlight = "#CCFFCC"
local divleadermarksplitcolor = "*CCCCCC"
local divleadermark = " *"
 
local function get_division(division)
Line 43 ⟶ 44:
 
local function winpct(w, l)
local pct = '–'
if (w + l) > 0 then
returnpct = rnd(w / (w + l), 23):gsub('^0', '')
end
return '–'pct
end
 
Line 65 ⟶ 67:
local division = args['division']:lower()
-- division leader record
local dloffset = 8*((tonumber(args[division .. 'leader']) or 1) - 1)
local dlhw = tonumber(args[dloffset + 3])
local dlhl = tonumber(args[dloffset + 4])
Line 123 ⟶ 125:
row:tag('td'):wikitext(gbformat(hw, hl, rw, rl, dlhw, dlhl, dlrw, dlrl))
-- home record
row:tag('td'):wikitext(hw .. '‍–‍' .. hl)
-- road record
row:tag('td'):wikitext(rw .. '‍–‍' .. rl)
-- div record
row:tag('td'):wikitext(divrecord)
Line 169 ⟶ 171:
-- rows
local pos = 1
local div1leader = tonumber(args[(args['div1name'] or args['div1name']):lower() .. 'leader'])
local div2leader = tonumber(args[(args['div2name'] or args['div2name']):lower() .. 'leader'])
local div3leader = tonumber(args[(args['div3name'] or args['div3name']):lower() .. 'leader'])
while args[(pos - 1)*8 + 1] or args[(pos - 1)*8 + 2] do
local offset = (pos - 1)*8
Line 192 ⟶ 194:
row = root:tag('tr'):css('background-color', rowcolor)
-- position
row:tag('th'):wikitext(pos .. div1leader .. div2leader .. div3leader)
-- team name
row:tag('td'):css('text-align', 'left'):wikitext(team)
Line 205 ⟶ 207:
-- played
row:tag('td'):wikitext(hw + hl + rw + rl)
if args['split' .. pos] then
root:tag('tr'):css('background-color', splitcolor):tag('td'):attr('colspan', 7)
end
pos = pos + 1
end