Modul:Team appearances list: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
kTidak ada ringkasan suntingan |
kTidak ada ringkasan suntingan |
||
(6 revisi perantara oleh 5 pengguna tidak ditampilkan) | |||
Baris 34:
return nil
end
error('Parameter ' .. name .. '
end
arg = tonumber(arg)
if type(arg) ~= 'number' then
error('Parameter ' .. name .. '
end
if math.floor(arg) ~= arg then
error('Parameter ' .. name .. '
end
if not (min <= arg and arg <= max) then
error('Parameter ' .. name .. '
end
return arg
Baris 51:
local arg = args[name]
if arg == nil or arg == '' then
error('Parameter ' .. name .. '
end
if type(arg) ~= 'string' then
error('Parameter ' .. name .. '
end
return arg
Baris 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
Baris 71 ⟶ 79:
if options.begin_year and options.end_year then
if options.begin_year > options.end_year then
error('Parameter end_year
end
end
Baris 142 ⟶ 150:
local function competition_information(args)
-- Return four tables with competition and team information:
-- * List of competition years
-- * Table of disqualified years (the team was absent, but there is an
-- article regarding the absent year).
Baris 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.
Baris 231 ⟶ 239:
end
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.
if inputName=="Eswatini" or inputName=="Swaziland" then
if year < 2018 or year == 2018 and comp == 'Commonwealth Games' then
return "Swaziland"
else
return "Eswatini"
end
elseif inputName=="Southern Rhodesia" or inputName=="Rhodesia" or inputName=="Zimbabwe" then
if year < 1980 then
if (comp=="British Empire Games"
or comp=="British Empire and Commonwealth Games"
or comp=="British Commonwealth Games"
or comp=="Commonwealth Games") then
return "Southern Rhodesia"
elseif comp=="Olimpiade Musim Panas" or comp=="Summer Paralympics" then
return "Rhodesia"
end
else
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
return "Northern Rhodesia"
else
return "Zambia"
end
elseif inputName=="Aden" or inputName=="South Arabia" or inputName=="Federation of South Arabia" then
if year < 1966 then
return "Aden"
else
return "South Arabia"
end
elseif inputName=="British Guiana" or inputName=="Guyana" then
if year < 1966 then
return "British Guiana"
else
return "Guyana"
end
elseif inputName=="Tanzania" or inputName=="Tanganyika" then
if year < 1966 then
return "Tanganyika"
else
return "Tanzania"
end
elseif inputName=="Ceylon" or inputName=="Sri Lanka" then
if year <= 1972 then
return "Ceylon"
else
return "Sri Lanka"
end
elseif inputName=="British Honduras" or inputName=="Belize" then
if year <= 1973 then
return "British Honduras"
else
return "Belize"
end
elseif inputName=="Dahomey" or inputName=="Benin" then
if year <= 1975 then
return "Dahomey"
else
return "Benin"
end
elseif inputName=="Upper Volta" or inputName=="Burkina Faso" then
if year <= 1983 then
Baris 247 ⟶ 323:
return "Burkina Faso"
end
elseif inputName=="Burma" or inputName=="Myanmar" then
if year < 1990 then
return "Burma"
else
return "Myanmar"
end
elseif inputName=="Germany" or inputName=="West Germany" then
if comp == "Summer Paralympics" or comp == "Winter Paralympics" then
if year < 1992 then
return "West Germany"
else
return "Germany"
end
end
elseif inputName=="Democratic Republic of the Congo" or inputName=="Zaire" then
if year >= 1984 and year <=1996 then
Baris 256 ⟶ 346:
or inputName=="Independent Olympic Athletes"
or inputName=="Independent Olympic Participants"
or inputName=="Olympic Athletes from Russia"
or inputName=="ROC") then
if year == 1992 or year==2014 then
return "Independent Olympic Participants"
Baris 266 ⟶ 357:
return "Olympic Athletes from Russia"
elseif year == 2020 then
return "Russian Olympic Committee athletes"
else
return inputName
end
elseif inputName=="Serbia and Montenegro" or inputName=="FR Yugoslavia" then
if year < 2004 then
if comp == "Mediterranean Games" then
return "FR Yugoslavia"
else
return "Yugoslavia"
end
else
return "Serbia and Montenegro"
end
elseif (inputName=="Refugee Olympic Team"
or inputName=="IOC Refugee Olympic Team") then
if year == 2016 then
return "Refugee Olympic Team"
elseif year == 2020 then
return "IOC Refugee Olympic Team"
else
return inputName
end
elseif (inputName=="Independent Paralympic Participants"
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"
elseif year == 2000 then
return "Individual Paralympic Athletes"
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"
else
return inputName
Baris 276 ⟶ 404:
return "North Macedonia"
end
elseif inputName=="Malaysia" or inputName=="Malaya" then
if year < 1963 then
return "Malaya"
else
return "Malaysia"
end
elseif inputName=="Ghana" or inputName=="Gold Coast" then
if year < 1957 then
return "Gold Coast"
else
return "Ghana"
end
end
return inputName
end
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
Baris 324 ⟶ 464:
end
local compName = gameName(y, args.competition)
local teamOut = teamName(y, args.team, args.competition)
if compName == 'FIS Alpine World Ski Championships' then
table.insert(appearances, string.format(
'[[%s pada %s %d|%s]]',
teamOut, compName, y, display
))
else
table.insert(appearances, string.format(
'[[%s pada %s %d|%s]]',
teamOut, compName, y, display
))
end
end
end
end
return
end
function p.main(frame)
load_data(frame)
return p._main(frame.args['team'] and frame.args or frame:getParent().args)
end
|