Content deleted Content added
update from sandbox to implement disqualified_year parameter (single year only) |
update from sandbox - more dynamic ability to handle competition renames |
||
Line 4:
local data_competitions
local data_old_names
local function load_data(frame)
-- Load data module (or its sandbox) and set variables from its exported data.
Line 11 ⟶ 12:
local datamod = mw.loadData('Module:Team appearances list/data' .. sandbox)
data_competitions = datamod.competitions
data_old_names = datamod.old_names
end
end
Line 58 ⟶ 60:
options.competition = valid_text('competition')
options.team = valid_text('team')
options.competitions = data_competitions[options.competition] or data_competitions[data_old_names[options.competition]]
local begin_optional
if options.competitions then
Line 175 ⟶ 177:
end
return comp_years, disqualified_years, competition_absences(absences or args)
end
local function gameName(year, inputName)
-- Modifies output of display being sent back to the hlist
-- for games that have had a name change but are still considered
-- the same competition.
if inputName=="World Athletics Championships" or inputName=="World Championships in Athletics" then
if year <= 2017 then
return "World Championships in Athletics"
else
return "World Athletics Championships"
end
elseif (inputName=="British Empire Games"
or inputName=="British Empire and Commonwealth Games"
or inputName=="British Commonwealth Games"
or inputName=="Commonwealth Games") then
if year <= 1950 then
return "British Empire Games"
elseif year <= 1966 then
return "British Empire and Commonwealth Games"
elseif year <= 1974 then
return "British Commonwealth Games"
else
return "Commonwealth Games"
end
elseif inputName=="Southeast Asian Peninsular Games" or inputName=="Southeast Asian Games" then
if year <= 1975 then
return "Southeast Asian Peninsular Games"
else
return "Southeast Asian Games"
end
end
return inputName
end
Line 219 ⟶ 254:
display = '<del>' .. display .. '</del>'
end
local compName = gameName(y, args.competition)
table.insert(appearances, string.format(
'[[%s at the %d %s|%s]]',
args.team, y,
))
end
Line 228 ⟶ 264:
return hlist(appearances)
end
function p.main(frame)
load_data(frame)
|