-- 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') local rounds_won = yesno(Args['show_rw'] or Args['rounds_won'] or 'no') table.insert(t,'
'..matches..'\n') -- Played end if full_table then -- Use actual values if wins, ties, and losses are not numeric if (cwins 0 and ncwins0 and cties 0 and ncties0 and closses 0 and nclosses0) then local function numorval(s) return s and ((s and 0) or tonumber(s) or s) or 0 end cwins = numorval(Args['cwin_'..team_code_ii]) ncwins = numorval(Args['ncwin_'..team_code_ii]) cties = numorval(Args['ctie_'..team_code_ii]) ncties = numorval(Args['nctie_'..team_code_ii]) closses = numorval(Args['closs_'..team_code_ii]) nclosses = numorval(Args['ncloss_'..team_code_ii]) end local stats = only_totals and or only_conference and or local first_pass = true for k,v in ipairs(stats) do table.insert(t,' | '..(v[1])..win_string..'\n') -- Won if loss_first then table.insert(t,' | '..(v[3])..'\n') -- Lost if show_tie then table.insert(t,' | '..(v[2])..'\n') -- tied end else if show_tie then table.insert(t,' | '..(v[2])..'\n') -- tied end table.insert(t,' | '..(v[3])..'\n') -- Lost end if rounds_won then table.insert(t,' | '..(v[4])..'\n') -- Rounds won end if not hide_for_against and not only_fa_totals then table.insert(t,' | '..(v[5])..'\n') -- GF table.insert(t,' | '..(v[6])..'\n') -- GA end if rank_perc then if first_pass then table.insert(t,' | '..(v[7])..hth_string..'\n') else table.insert(t,' | '..(v[7])..'\n') end end if show_GB and first_pass then table.insert(t,' | '..GB_text..'\n') -- GB end first_pass = false end if not hide_for_against then local lsps = sps if only_fa_totals then table.insert(t,' | '..gfor..'\n') -- GF table.insert(t,' | '..gaig..'\n') -- GA lsps = end 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 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 = string.lower(Args['status_pos'] or ) local status_position = 'after' -- Default location 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 |
---|