Content deleted Content added
new style for olympic wrestling, will need debug |
MusikBot II (talk | contribs) m Protected "Module:Sports table/Wrestling": High-risk template or module: 251 transclusions (more info) ([Edit=Require autoconfirmed or confirmed access] (indefinite)) |
||
(11 intermediate revisions by one other user not shown) | |||
Line 1:
-- Style for olympic wrestling tables
local pp = {}
function pp.header(t,Args,p_sub,pos_label,group_col,VTE_text,full_table,results_header_txt)
-- Load relevant modules
Line 6 ⟶ 8:
-- Create table header
-- Pre stuff
local team_width = Args['teamwidth'] or '
local sort_text = yesno(Args['sortable_table'] or 'no') and ' sortable' or ''
local show_played = not yesno(Args['hide_played'] or 'no')
Line 17 ⟶ 19:
local played_head_text = Args['pld_header'] or '<abbr title="Played">Pld</abbr>'
local group_head_text = Args['group_header'] or '<abbr title="Group">Grp</abbr>'
local round_head_text = Args['round_header'] or '<abbr title="Round">R</abbr>'
local team_head_text = Args['team_header'] or 'Athlete'
local show_win = yesno(Args['show_win'] or 'yes')
local show_loss = yesno(Args['show_loss'] or 'yes')
local show_tp = yesno(Args['show_tp'] or 'yes')
local show_round = yesno(Args['show_round'] or 'no')
-- Initialize
Line 44 ⟶ 49:
tt = p_sub.colhead(tt,28,'<abbr title="Lost">L</abbr>') -- Loss col
end
end
if show_round then
tt = p_sub.colhead(tt,28,round_head_text) -- Round col
end
tt = p_sub.colhead(tt,28,'<abbr title="Classification points">CP</abbr>') -- Classification points col
if show_tp then
end
if full_table then
tt.count = tt.count+1
Line 85 ⟶ 95:
local show_win = yesno(Args['show_win'] or 'yes')
local show_loss = yesno(Args['show_loss'] or 'yes')
local show_tp = yesno(Args['show_tp'] or 'yes')
local show_round = yesno(Args['show_round'] or 'no')
local digits = Args['digitpad']
Line 90 ⟶ 102:
local wins = tonumber(Args['win_'..team_code_ii]) or 0
local losses = tonumber(Args['loss_'..team_code_ii]) or 0
local round = Args['r_'..team_code_ii] or 0
local cp = tonumber(Args['cp_'..team_code_ii]) or 0
local tp = tonumber(Args['tp_'..team_code_ii]) or 0
Line 103 ⟶ 116:
-- What to rank the teams by
local ranking_style = string.lower(Args['ranking_style'] or (show_round and 'r' or 'cp'))
cp_fw = 'font-weight: bold;'▼
local win_fw, win_string, cp_fw, cp_string, round_fw, round_string = '', '', '', '', '', ''
cp_string = hth_string▼
if (ranking_style == 'w' or ranking_style == 'win' or ranking_style == 'wins') then
win_fw = 'font-weight:bold;'
win_string = hth_string
elseif (ranking_style == 'r' or ranking_style == 'rnd' or ranking_style == 'round') then
round_fw = 'font-weight: bold;'
round_string = hth_string
elseif (ranking_style == 'cp') then
else▼
win_string = hth_string
end
local show_played = not yesno(Args['hide_played'] or 'no')
Line 111 ⟶ 136:
end
if full_table then
-- Use actual values if wins
if (wins
local function numorval(s)
return s and ((s == '' and 0) or tonumber(s) or s) or 0
Line 120 ⟶ 145:
end
if show_win then
table.insert(t,'| style="'..ii_fw..win_fw..bg_col..'" |'..num_align(wins,digits)..win_string..'\n') -- Won
end
if show_loss then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..num_align(losses,digits)..'\n') -- Lost
end
end
if show_round then
table.insert(t,'| style="'..ii_fw..round_fw .. bg_col..'" |
end
-- Add − for negative point totals
if cp<0 then
table.insert(t,'| style="'..ii_fw..cp_fw..bg_col..'" | −'..num_align(-cp,digits)..
else
table.insert(t,'| style="'..ii_fw..cp_fw..bg_col..'" | '..num_align(cp,digits)..
end
if
if tp<0 then
table.insert(t,'| style="'..ii_fw..bg_col..'" | −'..num_align(-tp,digits)..'\n')
▲ else
else
▲ table.insert(t,'| style="'..ii_fw..bg_col..'" | '..num_align(tp,digits)..'\n')
table.insert(t,'| style="'..ii_fw..bg_col..'" | '..num_align(tp,digits)..'\n')
end
end
return {t=t, notes_exist=notes_exist, hth_id_list=hth_id_list}
|