Module:Team appearances list
Εμφάνιση

-- Αυτή η ενότητα υποστηρίζει [[Πρότυπο:Team appearances list]].
-- [SublimeLinter luacheck-globals:mw]
local p = {}
local compressSparseArray = require('Module:TableTools').compressSparseArray
local hlist = require('Module:List').horizont
local COMPETITIONS = {
["Αφρικανικοί Αγώνες"] = {
1965, 1973, 1978, 1987, 1991, 1995, 1999, 2003, 2007, 2011, 2015},
["Ασιατικοί Παρά Αγώνες"] = {
2010, 2014, 2018, 2022},
["Ευρωπαϊκό Πρωτάθλημα Στίβου"] = {
1934, 1938, 1946, 1950, 1954, 1958, 1962, 1966, 1969, 1971, 1974, 1978,
2015, 2019},
["Παγκόσμιο Πρωτάθλημα Ιππασίας FEI"] = {
1990, 1994, 1998, 2002, 2006, 2010, 2014, 2018},
["Αθλητιατρική"] = {
1951, 1955, 1959, 1963, 1967, 1971, 1975, 1979, 1983, 1987, 1991, 1993,
1997, 2001, 2005, 2009, 2013, 2017},
["Παναμερικανικοί Αγώνες"] = {
1951, 1955, 1959, 1963, 1967, 1971, 1975, 1979, 1983, 1987, 1991, 1995,
1999, 2003, 2007, 2011, 2015, 2019},
["Θερινές Πανεπιστημιάδες"] = {
1959, 1961, 1963, 1965, 1967, 1970, 1973, 1975, 1977, 1979, 1981, 1983,
1985, 1987, 1989, 1991, 1993, 1995, 1997, 1999, 2001, 2003, 2005, 2007,
2009, 2011, 2013, 2015, 2017},
["Χειμερινές Πανεπιστημιάδες"] = {
1960, 1962, 1964, 1966, 1968, 1972, 1978, 1981, 1983, 1985, 1987, 1989,
1991, 1993, 1995, 1997, 1999, 2001, 2003, 2005, 2007, 2009, 2011, 2013,
2015, 2017},
["Παγκόσμιο Πρωτάθλημα Στίβου"] = {
1983, 1987, 1991, 1993, 1995, 1997, 1999, 2001, 2003, 2005, 2007, 2009,
2011, 2013, 2015, 2017},
["Θερινοί Ολυμπιακοί Αγώνες"] = {
1896, 1900, 1904, 1908, 1912, 1920, 1924, 1928, 1932, 1936, 1948, 1952,
1956, 1960, 1964, 1968, 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2000,
2004, 2008, 2012, 2016, 2020, 2024, 2028},
["Χειμερινοί Ολυμπιακοί Αγώνες"] = {
1924, 1928, 1932, 1936, 1948, 1952, 1956, 1960, 1964, 1968, 1972, 1976,
1980, 1984, 1988, 1992, 1994, 1998, 2002, 2006, 2010, 2014, 2018, 2022,
2026},}
function p._main(args)
local begin_year = args.begin_year and tonumber(args.begin_year)
local end_year = args.end_year and tonumber(args.end_year)
local appearances = {}
local absences = {}
for _, v in pairs(compressSparseArray(args)) do
absences[string.sub(v, 1, 4)] = mw.getCurrentFrame()
end
local function processYear(y)
y = tostring(y)
if absences[y] then
table.insert(appearances, absences[y])
absences[y] = nil
else
table.insert(appearances, string.format(
'[[%s tại %s %s|%s]]', args.team, args.competition, y, y))
end
end
if COMPETITIONS[args.competition] then
for _, y in pairs(COMPETITIONS[args.competition]) do
if not begin_year or y >= begin_year then
processYear(y)
elseif end_year and y <= end_year then
break
end
end
elseif not tonumber(args.interval) then
error(tostring(args.interval))
else
for y = begin_year, (end_year or os.date('%Y')+args.interval),
args.interval do
processYear(y)
end
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
return p