Module:Year in sports
Appearance
![]() | This module depends on the following other modules: |
Implements {{Year in sports}}.
local getArgs = require('Module:Arguments').getArgs
local sidebar = require('Module:Sidebar')
local list = require('Module:List')
local parser = mw.ext.ParserFunctions
local sports = {
"American Football",
"aquatic sports",
"association football",
"badminton",
"baseball",
"basketball",
"chess",
"climbing",
"combat sports",
"sumo",
"cycling",
"equestrianism",
"esports",
"golf",
"gymnastics",
"ice sports",
"modern pentathlon",
"motorsport",
"racquetball",
"sailing",
"skiing",
"squash",
"table tennis",
"tennis",
"triathlon",
"volleyball",
"weightlifting"
}
local p = {}
function p.main(frame)
local args = getArgs(frame)
return p._main(frame, args)
end
function p._main(frame, args)
local year = args['year'] or parser["CURRENTYEAR"] or "2022"
local pages = {}
for i, sport in ipairs(sports) do
local s = year .. " in " .. sport
local page = mw.title.new(s, 0)
if (page.exists) then
table.insert(pages, "[[" .. s .. "|" .. sport .. "]]")
end
end
local l = list.horizontal(pages)
return sidebar.sidebar(frame, {content1 = l, name = "Year in sports", title = year .. " in sports"})
end
return p