Content deleted Content added
Use yesno module for options instead of manual list (copy from sandbox) |
add parsing of both args and parentargs which means we no longer need to pass (several) parameters between pages transcluding and the child page housing the table |
||
Line 5:
local p = {}
-- Helper functions
local function isnotblank(s)
return s and s:match( '^%s*(.-)%s*$' ) ~= ''
end
local function firstnonblank(s1,s2)
if ( s1 and s1:match( '^%s*(.-)%s*$' ) ~= '' ) then
return s1
elseif ( s2 and s2:match( '^%s*(.-)%s*$' ) ~= '' ) then
return s2
end
return nil
end
-- Main function
Line 10 ⟶ 24:
-- Declare locals
local Args = frame.args
local Pargs = frame:getParent().args
local ii_start, ii_end, N_rows_res = 0
local text_field_result
Line 19 ⟶ 34:
local jj, jjj
-- Exit early if we are using section transclusion for a different section
if( isnotblank(Pargs['transcludesection']) and isnotblank(Args['section']) ) then
if( Pargs['transcludesection'] ~= Args['section'] ) then
return ''
end
end
-- Get the custom start point for the table (most will start by default at 1
local top_pos = tonumber(Args['highest_pos']) or 1
Line 76 ⟶ 98:
-- Show all stats in table or just matches played and points
local pld_pts_val = firstnonblank(Pargs['only_pld_pts'], Args['only_pld_pts'])
local full_table
local hide_class_rules = false
Line 92 ⟶ 114:
-- Show groups or note
local show_groups_val = firstnonblank(Pargs['show_groups'], Args['show_groups'])
local group_col = false
if yesno(show_groups_val) then group_col = true end
-- Show match_table or not
local show_matches_val = firstnonblank(Pargs['show_matches'], Args['show_matches'])
local match_table = false
if yesno(show_matches_val) then match_table = true end
Line 130 ⟶ 152:
-- Determine what entries go into table
-- Find out which team to show (if any)
local ii_show = team_list[firstnonblank(Pargs['showteam'], Args['showteam'])] -- nil if non-existant
-- Start and end positions to show
local n_to_show = tonumber(Args['show_limit']) or N_teams
|