-- Style for football tableslocal pp = function pp.header(t,Args,p_sub,pos_label,group_col,VTE_text,full_table,results_header_txt) -- Load relevant modules local yesno = require('Module:Yesno') -- Create table header -- Pre stuff local team_width = Args['teamwidth'] or '190' local sort_text = yesno(Args['sortable_table'] or 'no') and ' sortable' or local show_played = not yesno(Args['hide_played'] or 'no') table.insert(t,'
'..matches..'\n') -- Played end if full_table then -- Use actual values if wins, draws, and losses are not numeric if (OTwins 0 and PKwins0 and wins 0 and draws0 and OTlosses 0 and PKlosses0 and losses 0) then local function numorval(s) return s and ((sand 0) or tonumber(s) or s) or 0 end wins = numorval(Args['win_'..team_code_ii]) OTwins = numorval(Args['OTwin_'..team_code_ii]) PKwins = numorval(Args['PKwin_'..team_code_ii] or Args['SOwin_'..team_code_ii]) draws = numorval(Args['draw_'..team_code_ii]) losses = numorval(Args['loss_'..team_code_ii]) OTlosses = numorval(Args['OTloss_'..team_code_ii]) PKlosses = numorval(Args['PKloss_'..team_code_ii] or Args['SOloss_'..team_code_ii]) end table.insert(t,' | '..wins..win_string..'\n') -- Won if show_OTwin then table.insert(t,' | '..OTwins..'\n') -- Won in OT end if show_PKwin then table.insert(t,' | '..PKwins..'\n') -- Won on PKs end if show_draw then table.insert(t,' | '..draws..'\n') -- Drawn end if show_OTloss and not OTloss_after then table.insert(t,' | '..OTlosses..'\n') -- Lost in OT end if show_PKloss and not PKloss_after then table.insert(t,' | '..PKlosses..'\n') -- Lost on PKs end table.insert(t,' | '..losses..'\n') -- Lost if show_OTloss and OTloss_after then table.insert(t,' | '..OTlosses..'\n') -- Lost in OT end if show_PKloss and PKloss_after then table.insert(t,' | '..PKlosses..'\n') -- Lost on PKs end if show_tiebr then table.insert(t,' | '..tiebr..'\n') -- Tie breaker end if not hide_for_against then table.insert(t,' | '..gfor..'\n') -- GF table.insert(t,' | '..gaig..'\n') -- GA table.insert(t,' | '..gcomp..'\n') -- Goal comparison end end if show_bonus_points then if s_pts < 0 then table.insert(t,' | -'..-s_pts..'\n') else table.insert(t,' | '..s_pts..'\n') end end if rank_points then -- Add - for negative point totals if points<0 then table.insert(t,' | -'..-points..hth_string..'\n') else table.insert(t,' | '..points..hth_string..'\n') end elseif rank_perc then table.insert(t,' | '..point_perc..hth_string..'\n') end if rank_ppg then table.insert(t,' | '..ppg..hth_string..'\n') end if show_GB then table.insert(t,' | '..GB_text..'\n') -- GB end return end function pp.status(Args) -- Declare status options -- ------------------------------------------------------------ -- NOTE: If you add to status_code, also add to status_called and status_letters | -- Or functionality will be compromised -- ------------------------------------------------------------ local status_code, status_called =, status_code = local status_letters = (Args['status_order'] or ) .. 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' -- Status position (before or after read and default) local stat_pos_val = Args['status_pos'] or local status_position = 'after' -- Default location stat_pos_val = string.lower(stat_pos_val) if stat_pos_val'before' then status_position = 'before' elseif stat_pos_val'after' then status_position = 'after' end -- Read in custom status options 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 return end return pp |
---|