-- Style for chess tableslocal pp =
function pp.preprocess(Args,N_teams,prefix,drawfractions) local legs = 1 for ii=1,N_teams do local ti = Args['team' .. ii] Args[prefix..'win_'..ti] = 0 Args[prefix..'draw_'..ti] = 0 Args[prefix..'loss_'..ti] = 0 local matchrow_str = Args[prefix..'matchrow_' .. ti] or for jj=1,N_teams do local tj = Args['team' .. jj] if ii ~= jj then if matchrow_str ~= then Args[prefix..'match_' .. ti .. '_' .. tj] = mw.ustring.match(matchrow_str, '^([^,]*),?') end local match_str = Args[prefix..'match_' .. ti .. '_' .. tj] or local game_count = 1 while match_str ~= do local gii = mw.ustring.match(match_str, '^([^%+]*)%+?') gii = mw.ustring.gsub(gii or ,'^%s*',) -- Trim starting whitespace gii = mw.ustring.gsub(gii or ,'%s*$',) -- Trim ending whitespace if gii
'½' then Args[prefix..'draw_'..ti] = Args[prefix..'draw_'..ti] + 1 if drawfractions then gii = mw.getCurrentFrame:extensionTag .. '
1⁄2' end elseif giifunction 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 player_width = Args['playerwidth'] or '190' local sort_text = local sort_table_val = Args['sortable_table'] or 'no' if yesno(sort_table_val) then sort_text = ' sortable' end -- Open table table.insert(t,'
'..rateii..'\n') -- Rating end if show_played then table.insert(t,' | '..matches..'\n') -- Played end table.insert(t,' | '..points..'\n') -- Points if full_table then if show_hth and hth_first then table.insert(t,' | '..(hth_local or )..'\n') -- Head-to-head end if show_sb and sb_first then table.insert(t,' | '..sb_score..'\n') -- Sonneborn–Berger end if show_win then if wdl_iff_hth and hth_local ' - ' then wins = ' - ' end table.insert(t,' | '..wins..'\n') -- Won end if show_draw then if wdl_iff_hth and hth_local ' - ' then draws = ' - ' end table.insert(t,' | '..draws..'\n') -- Drew end if show_loss then if wdl_iff_hth and hth_local ' - ' then losses = ' - ' end table.insert(t,' | '..losses..'\n') -- Lost end if show_hth and not hth_first then table.insert(t,' | '..(hth_local or )..'\n') -- Head-to-head if not first tiebreak end if show_sb and not sb_first then table.insert(t,' | '..sb_score..'\n') -- Sonneborn–Berger end for ecol=1,extra_cols do local extraii = Args['extra'..ecol..'_'..team_code_ii] or table.insert(t,' | '..extraii..'\n') -- Extra 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 = status_called = local status_letters = 'ACDEGHOPQRTXYZ' -- 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 if Args['status_text_' .. l] then status_code[l] = Args['status_text_' .. l] end end return end return pp |
---|