Modul:Country alias: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
kTidak ada ringkasan suntingan |
kTidak ada ringkasan suntingan |
||
(61 revisi perantara oleh 9 pengguna tidak ditampilkan) | |||
Baris 4:
--[[
The following country code is used for multiple countries:
ANG (workaround: added ANG_CGF for use with
The following names have different names/flags based on sport/year
Baris 10:
Hong Kong HKG, HKG_CGF (latter added to keep colonial flag)
Individual Olympic Athletes IOA, IOA_2000 (IOA changed to Independent Olympic Athletes in 2012)
Russian Athletes OAR (2018), ROC_2020 (2020 Summer, 2022 Winter)
SWZ Swaziland became Eswatini after the 2018 Pesta Olahraga Persemakmuran
MKD Macedonia became North Macedonia in 2019
ART No "Athlete" before Refugee Team @ 2017 AIMAG
D.R. of the Congo Was Zaire (ZAI) and Congo-Kinshasa (COK_COD)
The following
Anguilla AIA, ANG_CGF
Antigua and Barbuda ANT, ATG
Bahrain BHN, BHR, BRN
Curaçao CUR, CUW
East Timor TLS, TMP
Falkand Islands FAI, FLK
Faroe Islands FAR, FRO
Guernsey GGY, GUE
Baris 27 ⟶ 33:
Norfolk Island NFI, NFK
Oman OMA, OMN
Refugee Olympic Team ROA, ROT, EOR
Romania ROM, ROU
Saint Helena SHE, SHN
Baris 63 ⟶ 69:
local fullName = stripToNil(args.fullName)
if fullName then
year = tonumber(fullName:match('
end
if alias == 'ANG' then
if games == '
alias = 'ANG_CGF'
end
elseif alias == 'ART' then
if games == 'Pesta Olahraga Dalam Ruangan dan Bela Diri Asia' then
alias = 'ART_AIMAG'
end
elseif alias == 'GBR' then
if games == '
alias = 'GBR_WCA'
elseif games == '
if year == 2018 then
alias = 'GBR_WCA'
Baris 78 ⟶ 88:
end
elseif alias == 'HKG' then
if games == '
alias = 'HKG_CGF'
end
Baris 84 ⟶ 94:
if year == 2000 then
alias = 'IOA_2000'
end
elseif alias == 'MAL' or alias == 'MAS' then
if year and year < 1963 then
alias = 'MAL'
else
alias = 'MAS'
end
elseif alias == 'SWZ' then
if fullName then
if year and year >= 2018 and fullName ~= '
alias = 'SWZ_YO2018'
end
elseif year and year >= 2018 and games ~= '
alias = 'SWZ_YO2018'
else
alias = 'SWZ_YO2018'
end
elseif alias == 'MKD' then
if year and year < 2019 then
alias = 'MKD'
else
alias = 'MKD_2019'
end
elseif alias == 'VNM' then
if year and year <= 1954 then
alias = 'VIE'
end
elseif alias == 'RUS' then
if year and year==2020 then
if games=='Olimpiade Musim Panas' then
alias = 'ROC_2020'
elseif games=='Paralimpiade Musim Panas' then
alias = 'RPC'
end
elseif year and year==2022 and games=='Olimpiade Musim Dingin' then
alias = 'ROC_2020'
end
elseif alias == 'ROC' then
if year and year==1960 and games=='Olimpiade Musim Panas' then
alias = 'ROC_Formosa'
elseif year and ( year==1964 or year==1968 ) and games=='Olimpiade Musim Panas' then
alias = 'ROC_Taiwan'
elseif year and year==2020 and games=='Olimpiade Musim Panas' then
alias = 'ROC_2020'
elseif year and year==2022 and games=='Olimpiade Musim Dingin' then
alias = 'ROC_2020'
elseif year and year==2020 and games=='Paralimpiade Musim Panas' then
alias = 'RPC'
else
local pageName = mw.title.getCurrentTitle().text
if pageName == 'Atlet Komite Olimpiade Rusia pada Olimpiade' then
alias = 'ROC_2020'
end
end
elseif alias == 'YUG' or alias == 'SCG' then
if year and year > 1992 and year < 2004 and games ~= 'Paralimpiade Musim Panas' then
alias = 'FR_YUG'
end
elseif alias == 'ZAI' or alias == 'COD' then
if year and year < 1971 then
alias = 'COK_COD'
elseif year and year <= 1996 then
alias = 'ZAI'
else
alias = 'COD'
end
elseif alias == 'COK' then
if year and year == 1968 then
alias = 'COK_COD'
else
alias = 'COK'
end
end
Baris 122 ⟶ 195:
end
local data = mw.loadData('
local function countryAlias(args)
local alias = getAlias(args)
Baris 141 ⟶ 214:
local function flagIOC(frame)
-- Implement {{flagIOC}} which previously called this module three times.
-- Returns <flag> <country link> <athletes>, with the third value optional
local args = frame:getParent().args
local code = stripToNil(args[1]) or error('flagIOC parameter 1 should be a country code')
Baris 149 ⟶ 223:
alias = code,
fullName = games,
year = games:match('
games = games:gsub('
}
local fullName = countryAlias(parms)
parms.flag = true
local dispName = fullName
if fullName == 'ROC' then
fullName = 'Atlet Komite Olimpiade Rusia'
end
return (('[[File:{flag}|22x20px|border|alt=|link=]] [[{name} pada {games}|{dispName}]]{athletes}')
:gsub('{(%w+)}', {
athletes = athletes and
Baris 162 ⟶ 240:
games = games,
name = fullName,
dispName = dispName,
}))
end
local function flagXYZ(frame)
-- Implement {{flagIOC2}} and its variants which previously called this module three times.
-- Returns one of four possible outputs:
-- from flagIOC2: <flag> <country link> <athletes>, with the third value optional
-- from flagIOC2team: <flag> <country link> <country alias>
-- from flagIOC2athlete: <flag> <athlete(s)> <country alias/link>
-- from flagIOC2medalist: <athlete(s)><br><flag> <country link>
local args = frame:getParent().args
local dispType = stripToNil(frame.args['type'])
local code=''
local games=''
local athletes=''
if dispType == 'athlete-O' then
-- Implement [[Template:FlagIOCathlete]].
dispType = 'athlete'
args[3] = 'Olimpiade ' .. (args[3] or '')
end
if dispType == 'name' or dispType == 'team' then
code = stripToNil(args[1]) or error('Parameter 1 harus merupakan kode negara')
games = stripToNil(args[2]) or error('Parameter 2 harus merupakan nama kompetisi')
athletes = stripToNil(args[3])
elseif dispType == 'athlete' or dispType == 'medalist' then
athletes = stripToNil(args[1]) or error('Parameter 1 should be the name(s) of the athlete(s)')
code = stripToNil(args[2]) or error('Parameter 2 should be a country code')
games = stripToNil(args[3]) or error('Parameter 3 should be a competition name')
end
local parms = {
alias = code,
fullName = games,
year = games:match('%d+$'),
games = games:gsub(' ?%d+$', ''),
}
local fullName = countryAlias(parms)
parms.flag = true
local dispName = stripToNil(args.name)
if fullName == 'ROC' then
fullName = 'Atlet Komite Olimpiade Rusia'
dispName = 'ROC'
if dispType == 'team' then dispType = 'name' end
end
if dispType == 'name' then
return (('[[File:{flag}|22x20px|border|alt=|link=]] [[{name} pada {games}|{dispName}]]{athletes}')
:gsub('{(%w+)}', {
athletes = athletes and
(' <span style="font-size:90%;">(' .. athletes .. ')</span>') or
'',
flag = countryAlias(parms),
games = games,
name = fullName,
dispName = dispName or fullName,
}))
elseif dispType == 'team' then
return (('[[File:{flag}|22x20px|border|alt=|link=]] [[{name} pada {games}|{dispName}]]{alias}')
:gsub('{(%w+)}', {
alias = (' <span style="font-size:90%;">(' .. code .. ')</span>'),
flag = countryAlias(parms),
games = games,
name = fullName,
dispName = dispName or fullName,
}))
elseif dispType == 'athlete' then
return (('[[File:{flag}|22x20px|border|alt=|link=]] {athletes} <span style="font-size:90%;">([[{name} pada {games}|{dispName}]])</span>')
:gsub('{(%w+)}', {
athletes = athletes,
flag = countryAlias(parms),
games = games,
name = fullName,
dispName = code,
}))
elseif dispType == 'medalist' then
return (('{athletes}<br>[[File:{flag}|23x15px|border|alt=|link=]] [[{name} pada {games}|{dispName}]]')
:gsub('{(%w+)}', {
athletes = athletes,
flag = countryAlias(parms),
games = games,
name = fullName,
dispName = dispName or fullName,
}))
end
end
local function main(frame)
return countryAlias(frame.args)
Baris 171 ⟶ 332:
return {
flagIOC = flagIOC,
flagXYZ = flagXYZ,
main = main,
}
|