Module:Team appearances list: Difference between revisions

Content deleted Content added
Universiade
Let's not duplicate documentation
Line 1:
-- This module producesimplements a[[Template:Team horizontalappearances list of team appearances at a specified]].
-- sports competition; each item is in the format:
-- [[<team> at the <year> <competition>|<year]]. The module requires the
-- following parameters: begin_year, interval, team and competition. end_year
-- may be optionally defined if either the competition or the team is now
-- defunct. Additionally, any number of positional parameters may be specified,
-- each of which must be a year (or year range) in which the team was absent
-- from the competition.
 
local p = {}
local compressSparseArray = require('Module:TableTools').compressSparseArray
local hlist = require('Module:List').horizontalhorizonta
local valueUnion = require('Module:Set').valueUnion
 
local COMPETITIONS = {
["All-Africa Games"] = {
["years"] = {1965, 1973, 1978, 1987, 1991, 1995, 1999, 2003, 2007, 2011, 2015},
2015}},
["Asian Para Games"] = {
["years"] = {2010, 2014, 2018}},
["European Athletics Championships"] = {
["years"] = {1934, 1938, 1946, 1950, 1954, 1958, 1962, 1966, 1969, 1971, 1974, 1978,
1974, 1978, 1982, 1986, 1990, 1994, 1998, 2002, 2006, 2010, 2012, 2014, 2016,
2014, 2016, 2018}},
["Mediterranean Games"] = {
["years"] = {1951, 1955, 1959, 1963, 1967, 1971, 1975, 1979, 1983, 1987, 1991, 1993,
1991, 1993, 1997, 2001, 2005, 2009, 2013, 2017}},
["Pan American Games"] = {
["years"] = {1951, 1955, 1959, 1963, 1967, 1971, 1975, 1979, 1983, 1987, 1991, 1995,
1991, 1995, 1999, 2003, 2007, 2011, 2015, 2019}},
["Summer Universiade"] = {
["years"] = {1959, 1961, 1963, 1965, 1967, 1970, 1973, 1975, 1977, 1979, 1981, 1983,
1981, 1983, 1985, 1987, 1989, 1991, 1993, 1995, 1997, 1999, 2001, 2003, 2005, 2007,
2003, 2005, 2007, 2009, 2011, 2013, 2015, 2017, 2019}},
["Winter Universiade"] = {
["years"] = {1960, 1962, 1964, 1966, 1968, 1972, 1978, 1981, 1983, 1985, 1987, 1989,
1987, 1989, 1991, 1993, 1995, 1997, 1999, 2001, 2003, 2005, 2007, 2009, 2011, 2013,
2009, 2011, 2013, 2015, 2017, 2019}},
["World Championships in Athletics"] = {
["years"] = {1983, 1987, 1991, 1993, 1995, 1997, 1999, 2001, 2003, 2005, 2007, 2009,
2007, 2009, 2011, 2013, 2015, 2017}},}
 
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {parentOnly=true})
return p._main(args)
end
function p._main(args)
local begin_year = args.begin_year and tonumber(args.begin_year)
Line 69 ⟶ 56:
 
if COMPETITIONS[args.competition] then
for _, y in pairs(COMPETITIONS[args.competition].years) do
if not begin_year or y >= begin_year then
processYear(y)
Line 77 ⟶ 64:
end
else
for y = begin_year, (end_year or os.date('%Y')+args.interval),
args.interval do
processYear(y)
Line 83 ⟶ 70:
end
return hlist(valueUnion(absences, appearances))
end
 
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {parentOnly=true})
return p._main(args)
end