Module:FlaggIOC
Tú kanst upprætta kunningarsíðu um hetta modulið á Module:FlaggIOC/doc
local p = {}
local lang = mw.getContentLanguage()
local ccode = require('Module:Land/alfa3')
local cname = require('Module:Land/alfa3(2)')
function p.flagname(frame)
local countrycode = lang:uc(frame.args.kode)
if countrycode == "BRN" then
countrycode = "BHR"
else
countrycode = countrycode
end
if ccode[countrycode] == nil then
country = frame.args.kode
else
country = ccode[countrycode]
end
-- Kode angitt og er riktig?
if country == "" then
return "''Feilur í kotu''[[Bólkur:Síður við feili í FlagIOC-fyrimynd]]"
end
return country
end
function p.countryname( frame )
local countrycode;
if lang:uc(frame.args.kode) == 'EUA' then
countrycode = 'GER'
elseif lang:uc(frame.args.kode) == 'BRN' then
countrycode = 'BHR'
else
countrycode = lang:uc(frame.args.kode)
end
local country = ccode[countrycode]
if country ~= nil then
return country
elseif country ~= nil then
return '[[Bólkur:Síður við feili í FlagIOC-fyrimynd]]'
end
end
function p.year( frame )
local year_out
local year = tostring(lang:lc(frame.args.leker))
local countrycode = tostring(lang:uc(frame.args.kode))
if countrycode == 'EUN' or countrycode == 'SUS' then
year_out = 'OL'
return year_out
end
if year == 'summar-ol 1896' then
if countrycode == 'GRE' or 'ITA' then
year_out = 'OL-1896'
else
year_out = '1896'
end
elseif year == 'summar-ol 1900' then
if countrycode == 'CUB' or countrycode == 'GRE' or countrycode == 'HAI' or countrycode == 'IND' or countrycode == 'IRI' or countrycode == 'ITA' or countrycode == 'NOR' then
year_out = 'OL-1900'
else
year_out = '1900'
end
elseif year == 'summar-ol 1904' then
if countrycode == 'GRE' then
year_out = 'OL-1904'
else
year_out = '1904'
end
elseif year == 'summar-ol 1908' then
if countrycode == 'FIN' or countrycode == 'GRE' or countrycode == 'ITA' or countrycode == 'TUR' then
year_out = 'OL-1908'
else
year_out = '1908'
end
elseif year == 'summar-ol 1912' then
if countrycode == 'BOH' or countrycode == 'EGY' or countrycode == 'FIN' or countrycode == 'GRE' or countrycode == 'ITA' or countrycode == 'RSA' or countrycode == 'SRB' or countrycode == 'TUR' then
year_out = 'OL-1912'
else
year_out = '1912'
end
elseif year == 'summar-ol 1920' then
if countrycode == 'EGY' or countrycode == 'GRE' or countrycode == 'IND' or countrycode == 'ITA' then
year_out = 'OL-1920'
else
year_out = '1920'
end
elseif year == 'summar-ol 1924' or year == 'vetrar-ol 1924' then
if countrycode == 'GRE' or countrycode == 'HAI' or countrycode == 'HUN' or countrycode == 'IND' or countrycode == 'ITA' then
year_out = 'OL-1924'
else
year_out = '1924'
end
elseif year == 'summar-ol 1928' or year == 'vetrar-ol 1928' then
if countrycode == 'GRE' or countrycode == 'HAI' or countrycode == 'HUN' or countrycode == 'IND' or countrycode == 'ITA' or countrycode == 'MLT' or countrycode == 'RSA' then
year_out = 'OL-1928'
else
year_out = '1928'
end
elseif year == 'summar-ol 1932' or year == 'vetrar-ol 1932' then
if countrycode == 'GRE' or countrycode == 'HAI' or countrycode == 'HUN' or countrycode == 'IND' or countrycode == 'ITA' or countrycode == 'MLT' then
year_out = 'OL-1932'
else
year_out = '1932'
end
elseif year == 'summar-ol 1936' or year == 'vetrar-ol 1936' then
if countrycode == 'GRE' or countrycode == 'HUN' or countrycode == 'IND' or countrycode == 'ITA' or countrycode == 'MLT' then
year_out = 'OL-1936'
else
year_out = '1936'
end
elseif year == 'summar-ol 1948' or year == 'vetrar-ol 1948' then
if countrycode == 'BIR' or countrycode == 'GRE' or countrycode == 'GUY' or countrycode == 'LIE' or countrycode == countrycode == 'MLT' or countrycode == 'PUR' or countrycode == 'ROU' or countrycode == 'TRI' then
year_out = 'OL-1948'
else
year_out = '1948'
end
elseif year == 'summar-ol 1952' or year == 'vetrar-ol 1952' then
if countrycode == 'AHO' or countrycode == 'GRE' or countrycode == 'GUY' or countrycode == 'LIE' or countrycode == 'PUR' or countrycode == 'TRI' or countrycode == 'VIE' then
year_out = 'OL-1952'
else
year_out = '1952'
end
elseif year == 'summar-ol 1956' or year == 'vetrar-ol 1956' then
if countrycode == 'EUA' or countrycode == 'FIJ' or countrycode == 'GRE' or countrycode == 'GUY' or countrycode == 'LIE' or countrycode == 'PUR' or countrycode == 'VIE' then
year_out = 'OL-1956'
else
year_out = '1956'
end
elseif year == 'summar-ol 1960' or year == 'vetrar-ol 1960' then
if countrycode == 'BRA' or countrycode == 'FIJ' or countrycode == 'GRE' or countrycode == 'GUY' or countrycode == 'HAI' or countrycode == 'LIE' or countrycode == 'MLT' or countrycode == 'PUR' or countrycode == 'VIE' then
year_out = 'OL-1960'
else
year_out = '1960'
end
elseif year == 'summar-ol 1964' or year == 'vetrar-ol 1964' then
if countrycode == 'BAH' or countrycode == 'GRE' or countrycode == 'GUY' or countrycode == 'LIE' or countrycode == 'PUR' or countrycode == 'TAN' or countrycode == 'VIE' then
year_out = 'OL-1964'
else
year_out = '1964'
end
elseif year == 'summar-ol 1968' or year == 'vetrar-ol 1968' then
if countrycode == 'FIJ' or countrycode == 'FRG' or countrycode == 'GDR' or countrycode == 'GRE' or countrycode == 'LIE' or countrycode == 'PUR' or countrycode == 'VIE' or countrycode == 'ZAM' then
year_out = 'OL-1968'
else
year_out = '1968'
end
elseif year == 'summar-ol 1972' or year == 'vetrar-ol 1972' then
if countrycode == 'HAI' or countrycode == 'LBA' or countrycode == 'LES' or countrycode == 'LIE' or countrycode == 'MAW' or countrycode == 'PUR' or countrycode == 'SYR' or countrycode == 'VIE' or countrycode == 'ZAM' then
year_out = 'OL-1972'
else
year_out = '1972'
end
elseif year == 'summar-ol 1976' or year == 'vetrar-ol 1976' then
if countrycode == 'BIZ' or countrycode == 'PUR' or countrycode == 'ZAM' then
year_out = 'OL-1976'
else
year_out = '1976'
end
elseif year == 'summar-ol 1980' then
if countrycode == 'AND' or countrycode == 'AFG' or countrycode == 'AUS' or countrycode == 'BEL' or countrycode == 'DEN' or countrycode == 'ETH' or countrycode == 'FRA' or countrycode == 'GBR' or countrycode == 'HAI' or countrycode == 'IRL' or countrycode == 'ITA' or countrycode == 'LBA' or countrycode == 'LES' or countrycode == 'LIE' or countrycode == 'LUX' or countrycode == 'NED' or countrycode == 'NZL' or countrycode == 'POR' or countrycode == 'PUR' or countrycode == 'SMR' or countrycode == 'SYR' or countrycode == 'ESP' or countrycode == 'SUI' or countrycode == 'ZAM' then
year_out = 'OL-1980'
else
year_out = '1980'
end
elseif year == 'vetrar-ol 1980' then
year_out = '1980'
elseif year == 'summar-ol 1984' or year == 'vetrar-ol 1984' then
if countrycode == 'HAI' or countrycode == 'LES' or countrycode == 'MAW' or countrycode == 'PUR' or countrycode == 'ZAM' then
year_out = 'OL-1984'
else
year_out = '1984'
end
elseif year == 'summar-ol 1988' or year == 'vetrar-ol 1984' then
if countrycode == 'LES' or countrycode == 'MAW' or countrycode == 'PUR' or countrycode == 'ZAM' then
year_out = 'OL-1988'
else
year_out = '1988'
end
elseif year == 'summar-ol 1992' then
if countrycode == 'LES' or countrycode == 'MAW' or countrycode == 'PUR' or countrycode == 'RSA' or countrycode == 'ZAM' then
year_out = 'OL-1992'
elseif countrycode == 'EUN' then
year_out = 'OL'
else
year_out = '1992'
end
elseif year == 'vetrar-ol 1992' then
if countrycode == 'PUR' then
year_out = 'OL-1992'
elseif countrycode == 'EUN' then
year_out = 'OL'
else
year_out = '1992'
end
elseif year == 'vetrar-ol 1994' then
if countrycode == 'PUR' or countrycode == 'RSA' then
year_out = 'OL-1994'
else
year_out = '1994'
end
elseif year == 'summar-ol 1996' then
if countrycode == 'ETH' or countrycode == 'LES' or countrycode == 'MAW' or countrycode == 'SEY' or countrycode == 'YUG' then
year_out = 'OL-1996'
else
year_out = '1996'
end
elseif year == 'vetrar-ol 1998' then
if countrycode == 'YUG' then
year_out = 'OL-1998'
else
year_out = '1998'
end
elseif year == 'summar-ol 2000' then
if countrycode == 'ETH' or countrycode == 'LES' or countrycode == 'MAW' or countrycode == 'YUG' then
year_out = 'OL-2000'
else
year_out = '2000'
end
elseif year == 'vetrar-ol 2002' then
if countrycode == 'ETH' or countrycode == 'YUG' then
year_out = 'OL-2002'
else
year_out = '2002'
end
elseif year == 'summar-ol 2004' then
if countrycode == 'ETH' or countrycode == 'LES' or countrycode == 'MAW' or countrycode == 'IRQ' or countrycode == 'ITA' then
year_out = 'OL-2004'
else
year_out = '2004'
end
elseif year == 'vetrar-ol 2006' then
if countrycode == 'ETH' then
year_out = 'OL-2006'
else
year_out = '2006'
end
elseif year == 'summar-ol 2008' then
if countrycode == 'ETH' or countrycode == 'MAW' or countrycode == 'SRB' then
year_out = 'OL-2008'
else
year_out = '2008'
end
elseif year == 'vetrar-ol 2010' then
if countrycode == 'SRB' then
year_out = 'OL-2010'
else
year_out = '2010'
end
elseif year == 'summar-ol 2012' then
year_out = '2012'
elseif year == 'vetrar-ol 2014' then
year_out = '2014'
elseif year == 'summar-ol 2016' then
year_out = '2016'
elseif year == 'vetrar-ol 2018' then
year_out = '2018'
else
year_out = ''
end
return year_out
end
function p.location( frame )
local place;
local games = tostring(lang:lc(frame.args.leker))
if games == 'summar-ol 1896' or games == 'summar-ol 1906' or games == 'summar-ol 2004' then
place = 'í [[Athen]]'
elseif games == 'summar-ol 1900' or games == 'summar-ol 1924' then
place = 'í [[Paris]]'
elseif games == 'summar-ol 1904' then
place = 'í [[St. Louis]]'
elseif games == 'summar-ol 1908' or games == 'summar-ol 1948' or games == 'summar-ol 2012' then
place = 'í [[London]]'
elseif games == 'summar-ol 1912' then
place = 'í [[Stokkhólmur]]'
elseif games == 'summar-ol 1920' then
place = 'í [[Antwerpen]]'
elseif games == 'summar-ol 1928' then
place = 'í [[Amsterdam]]'
elseif games == 'summar-ol 1932' or games == 'summar-ol 1984' then
place = 'í [[Los Angeles]]'
elseif games == 'summar-ol 1936' then
place = 'í [[Berlin]]'
elseif games == 'summar-ol 1952' then
place = 'í [[Helsingfors]]'
elseif games == 'summar-ol 1956' then
place = 'í [[Melbourne]]/[[Stockholm]]'
elseif games == 'summar-ol 1960' then
place = 'í [[Rom]]'
elseif games == 'summar-ol 1964' then
place = 'í [[Tokyo]]'
elseif games == 'summar-ol 1968' then
place = 'í [[Meksikobýur]]'
elseif games == 'summar-ol 1972' then
place = 'í [[München]]'
elseif games == 'summar-ol 1976' then
place = 'í [[Montréal]]'
elseif games == 'summar-ol 1980' then
place = 'í [[Moskva]]'
elseif games == 'summar-ol 1988' then
place = 'í [[Seoul]]'
elseif games == 'summar-ol 1992' then
place = 'í [[Barcelona]]'
elseif games == 'summar-ol 1996' then
place = 'í [[Atlanta]]'
elseif games == 'summar-ol 2000' then
place = 'í [[Sydney]]'
elseif games == 'summar-ol 2008' then
place = 'í [[Beijing]]'
elseif games == 'summar-ol 2016' then
place = 'í [[Rio de Janeiro]]'
elseif games == 'vetrar-ol 1924' then
place = 'í [[Chamonix]]'
elseif games == 'vetrar-ol 1928' or games == 'vetrar-ol 1948' then
place = 'í [[St. Moritz]]'
elseif games == 'vetrar-ol 1932' or games == 'vetrar-ol 1980' then
place = 'í [[Lake Placid (New York)|Lake Placid]]'
elseif games == 'vetrar-ol 1936' then
place = 'í [[Garmisch-Partenkirchen]]'
elseif games == 'vetrar-ol 1952' then
place = 'í [[Oslo]]'
elseif games == 'vinter-ol 1956' then
place = 'í [[Cortina d'Ampezzo|Cortina d'Ampezzo]]'
elseif games == 'vetrar-ol 1960' then
place = 'í [[Squaw Valley Ski Resort|Squaw Valley]]'
elseif games == 'vetrar-ol 1964' or games == 'vinter-ol 1976' then
place = 'í [[Innsbruck]]'
elseif games == 'vetrar-ol 1968' then
place = 'í [[Grenoble]]'
elseif games == 'vetrar-ol 1972' then
place = 'í [[Sapporo]]'
elseif games == 'vetrar-ol 1984' then
place = 'í [[Sarajevo]]'
elseif games == 'vetrar-ol 1988' then
place = 'í [[Calgary]]'
elseif games == 'vetrar-ol 1992' then
place = 'í [[Albertville]]'
elseif games == 'vetrar-ol 1994' then
place = 'í [[Lillehammer]]'
elseif games == 'vetrar-ol 1998' then
place = 'í [[Nagano]]'
elseif games == 'vetrar-ol 2002' then
place = 'í [[Salt Lake City]]'
elseif games == 'vetrar-ol 2006' then
place = 'í [[Torino]]'
elseif games == 'vetrar-ol 2010' then
place = 'í [[Vancouver]]'
elseif games == 'vetrar-ol 2014' then
place = 'í [[Sotsji]]'
elseif games == 'vetrar-ol 2018' then
place = 'í [[Pyeongchang]]'
else
place = ''
end
return place
end
function p.link( frame )
local countrycode = lang:uc(frame.args.kode)
if countrycode == "BRN" then
countrycode = "BHR"
else
countrycode = countrycode
end
if ccode[countrycode] == nil then
country = frame.args.kode
else
country = ccode[countrycode]
end
local games_out;
local games = tostring(lang:lc(frame.args.leker))
if games == 'summar' then
games_out = 'summar-OL'
elseif games == 'vetrar' then
games_out = 'vetrar-OL'
elseif games == '' then
games_out = 'OL'
else
games_out = frame.args.leker
end
if country == nil then
link_out = tostring(frame.args.kode .. ' under ' .. games_out)
else
link_out = tostring(country .. ' under ' .. games_out)
end
if link_out ~= nil then
return link_out
elseif link_out == nil then
return '[[Bólkur:Síður við feili í FlagIOC-fyrimynd]]'
end
end
function p.linktext( frame )
local countrycode = lang:uc(frame.args.kode)
if countrycode == "BRN" then
countrycode = "BHR"
else
countrycode = countrycode
end
local country = ccode[countrycode]
local linktext_out = tostring(country)
if linktext_out == "nil" then
linktext_out = tostring(frame.args.kode)
else
linktext_out = linktext_out
end
return linktext_out
end
function p.athlete( frame )
local p_athlete = tostring(frame.args.utover)
local athlete_out;
if p_athlete ~= '' then
athlete_out = p_athlete
else
athlete_out = ''
end
if athlete_out ~= nil then
return athlete_out
elseif athlete_out == nil then
return ''
end
end
function p.partisipants( frame )
local p_partisipants = tonumber(frame.args.antall)
if p_partisipants ~= nil then
return ' <span style="font-size:90%;">(' .. frame.args.antall .. ')</span>'
elseif p_partisipants == nil then
return ''
end
end
function p.IOCcode( frame )
local countrycode = frame.args.kode
if cname[countrycode] ~=nil then
country = cname[countrycode]
else
country = frame.args.kode
end
if countrycode == "BRN" then
country = "BHR"
else
country = country
end
-- Kode angitt og er riktig?
if country == "" then
return "''Feilur í kotu''[[Bólkur:Síður við feili í FlagIOC-fyrimynd]]"
end
return ' <span style="font-size:90%;">(' .. country .. ')</span>'
end
function p.NameToCode( frame )
local countrycode = frame.args.kode
if cname[countrycode] ~=nil then
country = cname[countrycode]
else
country = frame.args.kode
end
if countrycode == "BRN" then
country = "BHR"
else
country = country
end
-- Kode angitt og er riktig?
if country == "" then
return "''Feilur í kotu''[[Bólkur:Síður við feili í FlagIOC-fyrimynd]]"
end
return country
end
return p