-- Style for sports tables with custom columnslocal pp =
function pp.get_col_styles(Args) -- Load relevant modules local yesno = require('Module:Yesno')
local col_style = local num_cols = 1 -- Default styles local default_style = Args['default_style'] or if default_style:match('^([Ww][Dd]?[Ll])') then -- Backwards compatibility with WDL if not yesno(Args['hide_played'] or 'no') then col_style[num_cols] = 'pld' num_cols = num_cols +1 end if yesno(Args['show_win'] or 'yes') then col_style[num_cols] = 'w' num_cols = num_cols +1 end local loss_first = yesno(Args['loss_before_draw'] or Args['loss_before_tie'] or false) if loss_first and yesno(Args['show_loss'] or 'yes') then col_style[num_cols] = 'l' num_cols = num_cols +1 end if yesno(Args['show_draw'] or default_style:match('^[Ww]([Dd])[Ll]')~=nil) then col_style[num_cols] = 'd' num_cols = num_cols +1 end if (not loss_first) and yesno(Args['show_loss'] or 'yes') then col_style[num_cols] = 'l' num_cols = num_cols +1 end local fa_letter = string.lower(Args['for_against_style'] or ) if fa_letter ~= then if fa_letter
'games' then fa_letter = 'game' elseif fa_letter
'game' then fa_letter = 'g' fa_word_sing = 'Game' fa_word_plur = 'Games' elseif fa_letter
'm' then fa_word_sing = 'Match' fa_word_plur = 'Matches' elseif fa_letter
'r' then fa_word_sing = 'Run' fa_word_plur = 'Runs' elseif fa_letter
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 local sort_text = yesno(Args['sortable_table'] or 'no') and ' sortable' or table.insert(t,'
'..cell_data..'\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 |
---|