-- Style for rugby union 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 '170' local sort_text = yesno(Args['sortable_table'] or 'no') and 'sortable' or local show_played = not yesno(Args['hide_played'] or 'no') local show_draw = yesno(Args['show_draw'] or 'yes') local show_points_for = yesno(Args['show_points_for'] or 'yes') local show_points_against = yesno(Args['show_points_against'] or 'yes') local show_points_difference = yesno(Args['show_points_difference'] or 'yes') local show_tries_for = yesno(Args['show_tries_for'] or 'yes') local show_tries_against = yesno(Args['show_tries_against'] or 'yes') local show_tries_difference = yesno(Args['show_tries_difference'] or 'no') local show_bonus = yesno(Args['show_bonus'] or 'yes') local bonus_total = yesno(Args['bonus_total'] or 'no') local show_cf = yesno(Args['show_cf'] or 'no') local ranking_style = string.lower(Args['ranking_style'] or 'pts') local show_adjust_points = yesno(Args['show_adjust_points'] or 'no') local grand_slam = yesno(Args['show_grand_slam'] or 'no') local show_points = true local show_ppg = false if ranking_style
'win' or ranking_style
'none' then show_points = false elseif ranking_style
-- Custom header local group_head_text = Args['group_header'] or 'Grp' local adjust_head_text = Args['adjust_header'] or 'B' table.insert(t,'
'..matches..'\n') -- Played end if full_table then table.insert(t,' | '..wins..win_string..'\n') -- Won if show_draw then table.insert(t,' | '..draws..'\n') -- Drawn end if show_points or show_points_difference then table.insert(t,' | '..losses..'\n') -- Lost else table.insert(t,' | '..losses..hth_string..'\n') -- Lost end if show_points_for then table.insert(t,' | '..pfor..'\n') -- PF end if show_points_against then table.insert(t,' | '..paig..'\n') -- PA end if show_points_difference then if show_points then table.insert(t,' | '..pcomp..'\n') -- PD else table.insert(t,' | '..pcomp..hth_string..'\n') -- PD end end if show_tries_for then table.insert(t,' | '..tf..'\n') -- TF end if show_tries_against then table.insert(t,' | '..ta..'\n') -- TA end if show_tries_difference then table.insert(t,' | '..tcomp..'\n') -- TD end if show_bonus then if bonus_total then table.insert(t,' | '..b..'\n') -- B else if grand_slam then table.insert(t,' | '..gs..'\n') -- GS end table.insert(t,' | '..tb..'\n') -- TB table.insert(t,' | '..lb..'\n') -- LB end end if show_adjust_points then if s_pts < 0 then table.insert(t,' | -'..num_align(-s_pts,digits)..'\n') else table.insert(t,' | '..num_align(s_pts,digits)..'\n') end end if show_ppg then table.insert(t,' | '..ppg..ppg_string..'\n') -- ppg end if show_points then -- Add - for negative point totals if points<0 then table.insert(t,' | -'..num_align(-points,digits)..hth_string..'\n') else table.insert(t,' | '..num_align(points,digits)..hth_string..'\n') end end if show_cf then table.insert(t,' | '..cf..'\n') -- CF 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 |
---|