Module:Team appearances list: Difference between revisions

Content deleted Content added
update from Module:Team appearances list/sandbox with minor tweaks
update from sandbox to implement disqualified_year parameter (single year only)
Line 72:
end
end
options.disqualified_year = valid_integer('disqualified_year', 1800, 2100, true)
return options
end
Line 138 ⟶ 139:
 
local function competition_information(args)
-- Return threefour tables with informationcompetition forand theteam specified competitioninformation:
-- * List of competition years that the team attended or could have attended.
-- * Table of absentdisqualified years. (the team was absent, but there is an
-- article regarding the absent year).
-- * Table of absent years (when the team did not attend).
-- * List of pairs of years (absent for each year in range, inclusive).
local options = make_options(args)
Line 165 ⟶ 168:
end
end
local disqualified_years = {}
return comp_years, competition_absences(absences or args)
if options.disqualified_year then
-- Input currently only allows entry of a single disqualified year.
-- However processing works for any number of such years.
disqualified_years[options.disqualified_year] = true
end
return comp_years, disqualified_years, competition_absences(absences or args)
end
 
Line 171 ⟶ 180:
load_data() -- in case this function is called by another module
local hlist = require('Module:List').horizontal
local competitions, disqualified_years, absent_years, absent_ranges = competition_information(args)
local current_year = tonumber(os.date('!%Y*t')).year
local function is_absent(y)
if absent_years[y] then
Line 206 ⟶ 215:
if y > current_year then
display = '<i>' .. display .. '</i>'
end
if disqualified_years[y] then
display = '<del>' .. display .. '</del>'
end
table.insert(appearances, string.format(