Content deleted Content added
another tweak |
also check for AIN at the 2026 Olympics |
||
(22 intermediate revisions by 3 users not shown) | |||
Line 60:
options.competition = valid_text('competition')
options.team = valid_text('team')
-- Check ROC/TPE
if options.team=='Republic of China' then
local pageYear = tonumber(mw.ustring.match(mw.title.getCurrentTitle().text, '[%d]+')) -- mw.title.getCurrentTitle().text:match('^%d+')
if pageYear and pageYear > 1950 and pageYear < 1980 then
options.team = 'Chinese Taipei'
end
end
-- end of ROC/TPE check
options.competitions = data_competitions[options.competition] or data_competitions[data_old_names[options.competition]]
local begin_optional
Line 180 ⟶ 188:
local function gameName(year, inputName)
-- Modifies output of display being sent back to the
-- for games that have had a name change but are still considered
-- the same competition.
Line 202 ⟶ 210:
return "Commonwealth Games"
end
elseif inputName=="Southeast Asian Peninsular Games"
or inputName=="Southeast Asian Games" or inputName=="SEAP Games"
or inputName=="SEA Games" then
if year <= 1975 then
return "
return "SEA Games"
end
elseif inputName=="Asian Indoor Games" or inputName=="Asian Indoor and Martial Arts Games" then
if year <= 2009 then
Line 225 ⟶ 236:
else
return "African Games"
end
elseif inputName=="Summer Universiade" or inputName=="Summer World University Games" then
if year < 2021 then
return "Summer Universiade"
else
return "Summer World University Games"
end
elseif inputName=="Winter Universiade" or inputName=="Winter World University Games" then
if year < 2021 then
return "Winter Universiade"
else
return "Winter World University Games"
end
else
Line 232 ⟶ 255:
local function teamName(year, inputName, comp)
-- Modifies output of display being sent back to the
-- for games that have had a name change but are still considered
-- the same competition.
Line 254 ⟶ 277:
return "Zimbabwe"
end
elseif (inputName=="Republic of China"
or inputName=="Formosa"
or inputName=="Taiwan"
or inputName=="Chinese Taipei") then
if year <= 1956 or year == 1972 or year == 1976 then
return "Republic of China"
elseif year==1960 then
return "Republic of China (Formosa)"
elseif year==1964 or year==1968 then
return "Taiwan"
elseif year > 1976 then
return "Chinese Taipei"
end
elseif inputName=="Northern Rhodesia" or inputName=="Zambia" then
if year <= 1964 then
Line 308 ⟶ 344:
return "Myanmar"
end
elseif inputName=="
if
if year < 1992 then
return "West Germany"
else
return "Germany"
end
end
elseif inputName=="Democratic Republic of the Congo" or inputName=="Zaire" or inputName=="Congo-Kinshasa" then
if year < 1971 then
return "Congo-Kinshasa"
elseif year >= 1971 and year <=1996 then
return "Zaire"
else
Line 318 ⟶ 364:
or inputName=="Independent Olympic Participants"
or inputName=="Olympic Athletes from Russia"
or inputName=="ROC"
or inputName=="Individual Neutral Athletes") then
if year == 1992 or year==2014 then
return "Independent Olympic Participants"
Line 327 ⟶ 374:
elseif year == 2018 then
return "Olympic Athletes from Russia"
elseif year == 2020
return "Russian Olympic Committee athletes"
elseif year == 2024 or year==2026 then
return "Individual Neutral Athletes"
else
return inputName
Line 334 ⟶ 383:
elseif inputName=="Serbia and Montenegro" or inputName=="FR Yugoslavia" then
if year < 2004 then
if
return "FR Yugoslavia"
else
Line 354 ⟶ 403:
or inputName=="Individual Paralympic Athletes"
or inputName=="Independent Paralympic Athletes"
or inputName=="RPC"
or inputName=="Neutral Paralympic Athletes") then
if year == 1992 then
return "Independent Paralympic Participants"
Line 361 ⟶ 411:
elseif year==2016 then
return "Independent Paralympic Athletes"
elseif year==2018 then
return "Neutral Paralympic Athletes"
elseif year == 2020 or year==2022 then
return "Russian Paralympic Committee athletes"
elseif year == 2024 then
return "Neutral Paralympic Athletes"
else
return inputName
Line 377 ⟶ 431:
else
return "Malaysia"
end
elseif inputName=="Ghana" or inputName=="Gold Coast" then
if year < 1957 then
return "Gold Coast"
else
return "Ghana"
end
elseif inputName=="Independent FINA Athletes"
or inputName=="FINA Refugee Team"
or inputName=="FINA athletes" then
if year==2017 or year==2019 then
return "Independent FINA Athletes"
elseif year==2022 then
return "FINA Refugee Team"
else
return "FINA athletes"
end
end
Line 385 ⟶ 455:
function p._main(args)
load_data() -- in case this function is called by another module
local
local competitions, disqualified_years, absent_years, absent_ranges = competition_information(args)
local current_year = os.date('!*t').year
Line 441 ⟶ 511:
end
end
return
end
function p._onlyGames(args)
load_data() -- in case this function is called by another module
local list = require('Module:List').horizontal
args.team = 'x'
local competitions, disqualified_years, absent_years, absent_ranges = competition_information(args)
local current_year = os.date('!*t').year
local appearances = {}
local absent_first, absent_last
for i = 1, #competitions + 1 do -- +1 to handle any trailing absences
local y = competitions[i]
if y then
local display = tostring(y)
if y > current_year then
display = '<i>' .. display .. '</i>'
end
local compName = gameName(y, args.competition)
if compName == 'FIS Alpine World Ski Championships' then
table.insert(appearances, string.format(
'[[%s %d|%s]]',
compName, y, display
))
else
table.insert(appearances, string.format(
'[[%d %s|%s]]',
y, compName, display
))
end
end
end
return list(appearances)
end
function p.main(frame)
load_data(frame)
return p._main(frame.args['team'] and frame.args or frame:getParent().args)
end
function p.onlyGames(frame)
load_data(frame)
return p._onlyGames(frame.args['competition'] and frame.args or frame:getParent().args)
end
|