Module:Cycling team
Module:Cycling team is hosted on Wikidata, where the code is developed. Currently there is one function Cycling team/squad which displays a list of team riders in particular season.
Currently it is deployed on these Wikipedias:
You can add your own Wikipedia by translation some messages in your language (look for l10nDef in code) and copying code to your wiki.
Requirements
editModule requires Template:Birth date and age2 (Q6438902) to be present on your wiki with name "Template:Birth date and age2" (can be redirect). See function getDateAndAgeOnDate if you want to handle it differently on your wiki.
Current issues / TODO list
edit- Sorting by surname - no proper way to do it.
- Footnotes for riders who have left/joined the team mid-season.
Usage
editTo use squad function, indicate Wikidata Qnum of team squad. Optionally indicate 1 or 2 (default) column layout.
Examples
editCannondale Pro Cycling team 2016
edit{{#invoke:Cycling team|squad|1=Q21769874}}
Topsport Vlaanderen-Baloise 2016, 1 column layout
edit{{#invoke:Cycling team|squad|1=Q21968189|columns=1}}
|
Code
local p = {}
function p.squad(frame)
local columns = tonumber(frame.args.columns) == 1 and tonumber(frame.args.columns) or 2 --defaults to two columns
local squadSeason = mw.wikibase.getEntityObject( frame.args[1] )
local flags = {}
local riderIds = {}
local riderNames = {}
local riderBirthdays = {}
local labelMissing = false
local startOfSeason = squadSeason.claims["P580"][1].mainsnak.datavalue.value.time
local i = 1
while squadSeason.claims["P527"][i] do
riderIds[i] = 'Q' .. squadSeason.claims["P527"][i].mainsnak.datavalue.value['numeric-id']
local rider = mw.wikibase.getEntityObject(riderIds[i])
local label = rider:getLabel()
local link = rider:getSitelink()
if label == null then
label = '\'\'' .. rider:getLabel('en') .. ' (en)\'\''
labelMissing = true
end
if link == null then
riderNames[i] = label
elseif label == link then
riderNames[i] = '[[' .. label .. ']]'
else
riderNames[i] = '[[' .. link .. '|' .. label .. ']]'
end
if pcall(function()
riderBirthdays[i] = rider.claims["P569"][1].mainsnak.datavalue.value.time
end
) then else riderBirthdays[i] = '' end
if pcall(function()
flags[i] = flag('Q' .. getNationalityOnDate (rider, startOfSeason), startOfSeason)
end
) then else flags[i] = '' end
i = i + 1
end
local tableBody = ''
local tableHeader = '<table border="0" cellspacing="0" cellpadding="2" width="100%">'
.. '<tr style="background-color:#FFDF80;"><th width="3%" style="text-align:left;"></th><th width="35%" style="text-align:left;">'
.. getSquadTableColumn(1) .. '</th><th width="42%" style="text-align:left;">' .. getSquadTableColumn(2) .. '</th></tr>'
local tableFoot = '</table>'
i = 1
local tableSize = table.getn(riderNames)
while riderNames[i] do
tableBody = tableBody .. string.format('<tr><td style="text-align: left;" colspan="2"><span class="nowrap"><span class="flagicon">%s</span> %s %s</span></td><td><span class="nowrap">%s</span></td></tr>',
flags[i], riderNames[i], wdLink(riderIds[i]), getDateAndAgeOnDate(frame, startOfSeason, riderBirthdays[i]))
if columns == 2 and math.floor((tableSize + 1)/2) == i then
tableBody = tableBody .. tableFoot ..'</td><td width="1%"></td><td style="vertical-align:top;" width="44%">' .. tableHeader
end
i = i + 1
end
local tableStart = '<table border="0"><tr><td style="vertical-align:top;" width="44%">'
local tableEnd = '</td></tr></table>'
if labelMissing then
tableEnd = tableEnd .. getMissingLabelTrackingCategory()
end
return tableStart .. tableHeader .. tableBody .. tableFoot .. tableEnd
end
function getNationalityOnDate (rider, date)
local nationalities = rider.claims["P27"]
local possibleNationalities = {}
local num = 1
for _, v in pairs(nationalities) do
if v.qualifiers then
if (not v.qualifiers["P580"] or v.qualifiers["P580"][1].datavalue.value.time <= date)
and
(not v.qualifiers["P582"] or v.qualifiers["P582"][1].datavalue.value.time >= date)
then
possibleNationalities[num] = v.mainsnak.datavalue.value['numeric-id']
num = num + 1
end
else
possibleNationalities[num] = v.mainsnak.datavalue.value['numeric-id']
num = num + 1
end
end
-- can there be active dual nationalities?
return possibleNationalities[1]
end
function getDateAndAgeOnDate (frame, onDate, date)
local _, _, y2, m2, d2 = string.find(date, "(%d+)-(%d+)-0*(%d+)")
if mw.site.server == "//www.wikidata.org" then
return string.format("%d-%d-%d", y2, m2, d2)
else
local _, _, y1, m1, d1 = string.find(onDate, "(%d+)-(%d+)-0*(%d+)")
return frame:expandTemplate{ title = 'Template:Birth date and age2', args = { y1, m1, d1, y2, m2, d2 } }
end
end
function wdLink (id)
return "[[File:Wikidata-logo S.svg|12px|link=d:" .. id .. "]]"
end
function getMissingLabelTrackingCategory()
local l10nDef = { }
l10nDef["//lv.wikipedia.org"] = '[[Category:Vikidatos trūkst nosaukuma latviešu valodā]]'
local l10n = l10nDef[mw.site.server]
if not l10n then
l10n = ''
end
return l10n
end
function getSquadTableColumn(x)
local l10nDef = { }
l10nDef["//en.wikipedia.org"] = {"Rider", "Date of birth"}
l10nDef["//es.wikipedia.org"] = {"Corredor", "Fecha de nacimiento"}
l10nDef["//fr.wikipedia.org"] = {"Coureur", "Date de naissance"}
l10nDef["//lv.wikipedia.org"] = {"Braucējs", "Dzimšanas datums"}
l10nDef["//ru.wikipedia.org"] = {"Гонщик", "Дата рождения"}
l10nDef["//www.wikidata.org"] = l10nDef["//en.wikipedia.org"]
local l10n = l10nDef[mw.site.server]
if not l10n then
l10n = l10nDef["//en.wikipedia.org"]
end
return l10n[x]
end
function flag (x, date)
_, _, yr, m, d = string.find(date, "(%d+)-(%d+)-(%d+)") -- yr = year, m = month, d = day
-- yr="1970" for test
local year = tonumber(yr)
-- testing if x is the value of p27 (pays de nationalité/country of citizenship) of a person
if x == 'Q16' then return "[[File:Flag of Canada (Pantone).svg|border|20px|CAN]]" end
if x == 'Q17' then return "[[File:Flag of Japan.svg|border|20px|JPN]]" end
if x == 'Q20' then return "[[File:Flag of Norway.svg|border|20px|NOR]]" end
if x == 'Q27' then return "[[File:Flag of Ireland.svg|border|20px|IRL]]" end
if x == 'Q28' then return "[[File:Flag of Hungary.svg|border|20px|HUN]]" end
if x == 'Q29' then if year >= 1977 and year <= 1981 then return "[[File:Flag of Spain (1977 - 1981).svg|border|20px|ESP]]" end
return "[[File:Flag of Spain.svg|border|20px|ESP]]" end
if x == 'Q30' then return "[[File:Flag of the United States (Pantone).svg|border|20px|USA]]" end
if x == 'Q31' then return "[[File:Flag of Belgium (civil).svg|border|20px|BEL]]" end
if x == 'Q32' then return "[[File:Flag of Luxembourg.svg|border|20px|LUX]]" end
if x == 'Q33' then return "[[File:Flag of Finland.svg|border|20px|FIN]]" end
if x == 'Q34' then return "[[File:Flag of Sweden.svg|border|20px|SWE]]" end
if x == 'Q35' then return "[[File:Flag of Denmark.svg|border|20px|DEN]]" end
if x == 'Q36' then return "[[File:Flag of Poland.svg|border|20px|POL]]" end
if x == 'Q37' then return "[[File:Flag of Lithuania.svg|border|20px|LTU]]" end
if x == 'Q38' then if year >= 1861 and year <= 1946 then return "[[File:Flag of Italy (1861-1946) crowned.svg|border|20px|ITA]]" end
return "[[File:Flag of Italy.svg|border|20px|ITA]]" end
if x == 'Q39' then return "[[File:Flag of Switzerland (Pantone).svg|border|15px|SUI]]" end
if x == 'Q40' then return "[[File:Flag of Austria.svg|border|20px|AUT]]" end
if x == 'Q41' then return "[[File:Flag of Greece.svg|border|20px|GRE]]" end
if x == 'Q43' then return "[[File:Flag of Turkey.svg|border|20px|TUR]]" end
if x == 'Q45' then return "[[File:Flag of Portugal.svg|border|20px|POR]]" end
if x == 'Q55' then return "[[File:Flag of the Netherlands.svg|border|20px|NED]]" end
if x == 'Q77' then return "[[File:Flag of Uruguay.svg|border|20px|URU]]" end
if x == 'Q79' then return "[[File:Flag of Egypt.svg|border|20px|EGY]]" end
if x == 'Q96' then return "[[File:Flag of Mexico.svg|border|20px|MEX]]" end
if x == 'Q114' then return "[[File:Flag of Kenya.svg|border|20px|KEN]]" end
if x == 'Q115' then return "[[File:Flag of Ethiopia.svg|border|20px|ETH]]" end
if x == 'Q117' then return "[[File:Flag of Ghana.svg|border|20px|GHA]]" end
if x == 'Q142' then return "[[File:Flag of France (1794–1815, 1830–1974, 2020–present).svg|border|20px|FRA]]" end
if x == 'Q145' then return "[[File:Flag of the United Kingdom.svg|border|20px|GBR]]" end
if x == 'Q148' then return "[[File:Flag of the People's Republic of China.svg|border|20px|CHN]]" end
if x == 'Q155' then return "[[File:Flag of Brazil.svg|border|20px|BRA]]" end
if x == 'Q159' then return "[[File:Flag of Russia.svg|border|20px|RUS]]" end
if x == 'Q176' then return "[[File:Flag of Quebec.svg|border|20px]]" end
if x == 'Q183' then return "[[File:Flag of Germany.svg|border|20px|GER]]" end
if x == 'Q184' then return "[[File:Flag of Belarus.svg|border|20px|BLR]]" end
if x == 'Q189' then return "[[File:Flag of Iceland.svg|border|20px|ISL]]" end
if x == 'Q191' then return "[[File:Flag of Estonia.svg|border|20px|EST]]" end
if x == 'Q211' then return "[[File:Flag of Latvia.svg|border|20px|LAT]]" end
if x == 'Q212' then return "[[File:Flag of Ukraine.svg|border|20px|UKR]]" end
if x == 'Q213' then return "[[File:Flag of the Czech Republic.svg|border|20px|CZE]]" end
if x == 'Q214' then return "[[File:Flag of Slovakia.svg|border|20px|SVK]]" end
if x == 'Q215' then return "[[File:Flag of Slovenia.svg|border|20px|SLO]]" end
if x == 'Q217' then return "[[File:Flag of Moldova.svg|border|20px|MDA]]" end
if x == 'Q218' then return "[[File:Flag of Romania.svg|border|20px|ROU]]" end
if x == 'Q219' then return "[[File:Flag of Bulgaria.svg|border|20px|BUL]]" end
if x == 'Q221' then return "[[File:Flag of Macedonia.svg|border|20px|MKD]]" end
if x == 'Q222' then return "[[File:Flag of Albania.svg|border|20px|ALB]]" end
if x == 'Q224' then return "[[File:Flag of Croatia.svg|border|20px|CRO]]" end
if x == 'Q225' then return "[[File:Flag of Bosnia and Herzegovina.svg|border|20px|BIH]]" end
if x == 'Q227' then return "[[File:Flag of Azerbaijan.svg|border|20px|AZE]]" end
if x == 'Q228' then return "[[File:Flag of Andorra.svg|border|20px|AND]]" end
if x == 'Q229' then return "[[File:Flag of Cyprus (1960-2006).svg|border|20px|CYP]]" end
if x == 'Q230' then return "[[File:Flag of Georgia.svg|border|20px|GEO]]" end
if x == 'Q232' then return "[[File:Flag of Kazakhstan.svg|border|20px|KAZ]]" end
if x == 'Q233' then return "[[File:Flag of Malta.svg|border|20px|MLT]]" end
if x == 'Q235' then return "[[File:Flag of Monaco.svg|border|20px|MON]]" end
if x == 'Q236' then return "[[File:Flag of Montenegro.svg|border|20px|MNE]]" end
if x == 'Q237' then return "[[File:Flag of the Vatican City.svg|border|15px|VAT]]" end
if x == 'Q238' then return "[[File:Flag of San Marino.svg|border|20px|SMR]]" end
if x == 'Q241' then return "[[File:Flag of Cuba.svg|border|20px|CUB]]" end
if x == 'Q242' then return "[[File:Flag of Belize.svg|border|20px|BIZ]]" end
if x == 'Q244' then return "[[File:Flag of Barbados.svg|border|20px|BAR]]" end
if x == 'Q252' then return "[[File:Flag of Indonesia.svg|border|20px|INA]]" end
if x == 'Q258' then return "[[File:Flag of South Africa.svg|border|20px|RSA]]" end
if x == 'Q262' then return "[[File:Flag of Algeria.svg|border|20px|ALG]]" end
if x == 'Q265' then return "[[File:Flag of Uzbekistan.svg|border|20px|UZB]]" end
if x == 'Q298' then return "[[File:Flag of Chile.svg|border|20px|CHI]]" end
if x == 'Q334' then return "[[File:Flag of Singapore.svg|border|20px|SIN]]" end
if x == 'Q347' then return "[[File:Flag of Liechtenstein.svg|border|20px|LIE]]" end
if x == 'Q398' then return "[[File:Flag of Bahrain.svg|border|20px|BRN]]" end
if x == 'Q399' then return "[[File:Flag of Armenia.svg|border|20px|ARM]]" end
if x == 'Q403' then return "[[File:Flag of Serbia.svg|border|20px|SRB]]" end
if x == 'Q408' then return "[[File:Flag of Australia (converted).svg|border|20px|AUS]]" end
if x == 'Q414' then return "[[File:Flag of Argentina.svg|border|20px|ARG]]" end
if x == 'Q419' then return "[[File:Flag of Peru.svg|border|20px|PER]]" end
if x == 'Q423' then return "[[File:Flag of North Korea.svg|border|20px|PRK]]" end
if x == 'Q424' then return "[[File:Flag of Cambodia.svg|border|20px|CAM]]" end
if x == 'Q574' then return "[[File:Flag of East Timor.svg|border|20px|TLS]]" end
if x == 'Q657' then return "[[File:Flag of Chad.svg|border|20px|CHA]]" end
if x == 'Q664' then return "[[File:Flag of New Zealand.svg|border|20px|NZL]]" end
if x == 'Q668' then return "[[File:Flag of India.svg|border|20px|IND]]" end
if x == 'Q672' then return "[[File:Flag of Tuvalu.svg|border|20px|TUV]]" end
if x == 'Q678' then return "[[File:Flag of Tonga.svg|border|20px|TGA]]" end
if x == 'Q683' then return "[[File:Flag of Samoa.svg|border|20px|SAM]]" end
if x == 'Q685' then return "[[File:Flag of the Solomon Islands.svg|border|20px|SOL]]" end
if x == 'Q686' then return "[[File:Flag of Vanuatu.svg|border|20px|VAN]]" end
if x == 'Q691' then return "[[File:Flag of Papua New Guinea.svg|border|20px|PNG]]" end
if x == 'Q695' then return "[[File:Flag of Palau.svg|border|20px|PLW]]" end
if x == 'Q697' then return "[[File:Flag of Nauru.svg|border|20px|NRU]]" end
if x == 'Q702' then return "[[File:Flag of the Federated States of Micronesia.svg|border|20px|FSM]]" end
if x == 'Q709' then return "[[File:Flag of the Marshall Islands.svg|border|20px|MHL]]" end
if x == 'Q710' then return "[[File:Flag of Kiribati.svg|border|20px|KIR]]" end
if x == 'Q711' then return "[[File:Flag of Mongolia.svg|border|20px|MGL]]" end
if x == 'Q712' then return "[[File:Flag of Fiji.svg|border|20px|FIJ]]" end
if x == 'Q717' then return "[[File:Flag of Venezuela.svg|border|20px|VEN]]" end
if x == 'Q730' then return "[[File:Flag of Suriname.svg|border|20px|SUR]]" end
if x == 'Q733' then return "[[File:Flag of Paraguay.svg|border|20px|PAR]]" end
if x == 'Q734' then return "[[File:Flag of Guyana.svg|border|20px|GUY]]" end
if x == 'Q736' then return "[[File:Flag of Ecuador.svg|border|20px|ECU]]" end
if x == 'Q739' then return "[[File:Flag of Colombia.svg|border|20px|COL]]" end
if x == 'Q750' then return "[[File:Flag of Bolivia (state).svg|border|20px|BOL]]" end
if x == 'Q754' then return "[[File:Flag of Trinidad and Tobago.svg|border|20px|TTO]]" end
if x == 'Q757' then return "[[File:Flag of Saint Vincent and the Grenadines.svg|border|20px|VIN]]" end
if x == 'Q760' then return "[[File:Flag of Saint Lucia.svg|border|20px|LCA]]" end
if x == 'Q763' then return "[[File:Flag of Saint Kitts and Nevis.svg|border|20px|SKN]]" end
if x == 'Q766' then return "[[File:Flag of Jamaica.svg|border|20px|JAM]]" end
if x == 'Q769' then return "[[File:Flag of Grenada.svg|border|20px|GRN]]" end
if x == 'Q774' then return "[[File:Flag of Guatemala.svg|border|20px|GUA]]" end
if x == 'Q778' then return "[[File:Flag of the Bahamas.svg|border|20px|BAH]]" end
if x == 'Q781' then return "[[File:Flag of Antigua and Barbuda.svg|border|20px|ANT]]" end
if x == 'Q783' then return "[[File:Flag of Honduras.svg|border|20px|HON]]" end
if x == 'Q784' then return "[[File:Flag of Dominica.svg|border|20px|DMA]]" end
if x == 'Q786' then return "[[File:Flag of the Dominican Republic.svg|border|20px|DOM]]" end
if x == 'Q790' then return "[[File:Flag of Haiti.svg|border|20px|HAI]]" end
if x == 'Q792' then return "[[File:Flag of El Salvador.svg|border|20px|ESA]]" end
if x == 'Q794' then return "[[File:Flag of Iran.svg|border|20px|IRI]]" end
if x == 'Q796' then return "[[File:Flag of Iraq.svg|border|20px|IRQ]]" end
if x == 'Q800' then return "[[File:Flag of Costa Rica.svg|border|20px|CRC]]" end
if x == 'Q801' then return "[[File:Flag of Israel.svg|border|20px|ISR]]" end
if x == 'Q804' then return "[[File:Flag of Panama.svg|border|20px|PAN]]" end
if x == 'Q805' then return "[[File:Flag of Yemen.svg|border|20px|YEM]]" end
if x == 'Q810' then return "[[File:Flag of Jordan.svg|border|20px|JOR]]" end
if x == 'Q811' then return "[[File:Flag of Nicaragua.svg|border|20px|NCA]]" end
if x == 'Q813' then return "[[File:Flag of Kyrgyzstan.svg|border|20px|KGZ]]" end
if x == 'Q817' then return "[[File:Flag of Kuwait.svg|border|20px|KUW]]" end
if x == 'Q819' then return "[[File:Flag of Laos.svg|border|20px|LAO]]" end
if x == 'Q822' then return "[[File:Flag of Lebanon.svg|border|20px|LIB]]" end
if x == 'Q826' then return "[[File:Flag of Maldives.svg|border|20px|MDV]]" end
if x == 'Q833' then return "[[File:Flag of Malaysia.svg|border|20px|MAS]]" end
if x == 'Q836' then return "[[File:Flag of Myanmar.svg|border|20px|MYA]]" end
if x == 'Q837' then return "[[File:Flag of Nepal.svg|15px|NEP]]" end
if x == 'Q842' then return "[[File:Flag of Oman.svg|border|20px|OMA]]" end
if x == 'Q843' then return "[[File:Flag of Pakistan.svg|border|20px|PAK]]" end
if x == 'Q846' then return "[[File:Flag of Qatar.svg|border|20px|QAT]]" end
if x == 'Q851' then return "[[File:Flag of Saudi Arabia.svg|border|20px|KSA]]" end
if x == 'Q854' then return "[[File:Flag of Sri Lanka.svg|border|20px|SRI]]" end
if x == 'Q858' then return "[[File:Flag of Syria.svg|border|20px|SYR]]" end
if x == 'Q863' then return "[[File:Flag of Tajikistan.svg|border|20px|TJK]]" end
if x == 'Q865' then return "[[File:Flag of the Republic of China.svg|border|20px|TPE]]" end
if x == 'Q869' then return "[[File:Flag of Thailand.svg|border|20px|THA]]" end
if x == 'Q874' then return "[[File:Flag of Turkmenistan.svg|border|20px|THM]]" end
if x == 'Q878' then return "[[File:Flag of the United Arab Emirates.svg|border|20px|UAE]]" end
if x == 'Q881' then return "[[File:Flag of Vietnam.svg|border|20px|VIE]]" end
if x == 'Q884' then return "[[File:Flag of South Korea.svg|border|20px|KOR]]" end
if x == 'Q889' then return "[[File:Flag of Afghanistan.svg|border|20px|AFG]]" end
if x == 'Q902' then return "[[File:Flag of Bangladesh.svg|border|20px|BAN]]" end
if x == 'Q912' then return "[[File:Flag of Mali.svg|border|20px|MLI]]" end
if x == 'Q916' then return "[[File:Flag of Angola.svg|border|20px|ANG]]" end
if x == 'Q917' then return "[[File:Flag of Bhutan.svg|border|20px|BHU]]" end
if x == 'Q921' then return "[[File:Flag of Brunei.svg|border|20px|BRU]]" end
if x == 'Q924' then return "[[File:Flag of Tanzania.svg|border|20px|TAN]]" end
if x == 'Q928' then return "[[File:Flag of the Philippines.svg|border|20px|PHI]]" end
if x == 'Q929' then return "[[File:Flag of the Central African Republic.svg|border|20px|CAF]]" end
if x == 'Q945' then return "[[File:Flag of Togo.svg|border|20px|TOG]]" end
if x == 'Q948' then return "[[File:Flag of Tunisia.svg|border|20px|TUN]]" end
if x == 'Q953' then return "[[File:Flag of Zambia.svg|border|20px|ZAM]]" end
if x == 'Q954' then return "[[File:Flag of Zimbabwe.svg|border|20px|ZIM]]" end
if x == 'Q958' then return "[[File:Flag of South Sudan.svg|border|20px|SSD]]" end
if x == 'Q962' then return "[[File:Flag of Benin.svg|border|20px|BEN]]" end
if x == 'Q963' then return "[[File:Flag of Botswana.svg|border|20px|BOT]]" end
if x == 'Q965' then return "[[File:Flag of Burkina Faso.svg|border|20px|BUR]]" end
if x == 'Q967' then return "[[File:Flag of Burundi.svg|border|20px|BDI]]" end
if x == 'Q970' then return "[[File:Flag of the Comoros.svg|border|20px|COM]]" end
if x == 'Q971' then return "[[File:Flag of the Republic of the Congo.svg|border|20px|CGO]]" end
if x == 'Q974' then return "[[File:Flag of the Democratic Republic of the Congo.svg|border|20px|COD]]" end
if x == 'Q977' then return "[[File:Flag of Djibouti.svg|border|20px|DJI]]" end
if x == 'Q983' then return "[[File:Flag of Equatorial Guinea.svg|border|20px|GEQ]]" end
if x == 'Q986' then return "[[File:Flag of Eritrea.svg|border|20px|ERI]]" end
if x == 'Q1000' then return "[[File:Flag of Gabon.svg|border|20px|GAB]]" end
if x == 'Q1005' then return "[[File:Flag of The Gambia.svg|border|20px|GAM]]" end
if x == 'Q1006' then return "[[File:Flag of Guinea.svg|border|20px|GUI]]" end
if x == 'Q1007' then return "[[File:Flag of Guinea-Bissau.svg|border|20px|GBS]]" end
if x == 'Q1008' then return "[[File:Flag of Côte d'Ivoire.svg|border|20px|CIV]]" end
if x == 'Q1009' then return "[[File:Flag of Cameroon.svg|border|20px|CMR]]" end
if x == 'Q1011' then return "[[File:Flag of Cape Verde.svg|border|20px|CPV]]" end
if x == 'Q1013' then return "[[File:Flag of Lesotho.svg|border|20px|LES]]" end
if x == 'Q1014' then return "[[File:Flag of Liberia.svg|border|20px|LBR]]" end
if x == 'Q1016' then return "[[File:Flag of Libya (1951).svg|border|20px|LBA]]" end
if x == 'Q1019' then return "[[File:Flag of Madagascar.svg|border|20px|MAD]]" end
if x == 'Q1020' then return "[[File:Flag of Malawi.svg|border|20px|MAW]]" end
if x == 'Q1025' then return "[[File:Flag of Mauritania.svg|border|20px|MTN]]" end
if x == 'Q1027' then return "[[File:Flag of Mauritius.svg|border|20px|MRI]]" end
if x == 'Q1028' then return "[[File:Flag of Morocco.svg|border|20px|MAR]]" end
if x == 'Q1029' then return "[[File:Flag of Mozambique.svg|border|20px|MOZ]]" end
if x == 'Q1030' then return "[[File:Flag of Namibia.svg|border|20px|NAM]]" end
if x == 'Q1032' then return "[[File:Flag of Niger.svg|border|20px|NIG]]" end
if x == 'Q1033' then return "[[File:Flag of Nigeria.svg|border|20px|NGR]]" end
if x == 'Q1036' then return "[[File:Flag of Uganda.svg|border|20px|UGA]]" end
if x == 'Q1037' then return "[[File:Flag of Rwanda.svg|border|20px|RWA]]" end
if x == 'Q1039' then return "[[File:Flag of Sao Tome and Principe.svg|border|20px|STP]]" end
if x == 'Q1041' then return "[[File:Flag of Senegal.svg|border|20px|SEN]]" end
if x == 'Q1042' then return "[[File:Flag of Seychelles.svg|border|20px|SEY]]" end
if x == 'Q1044' then return "[[File:Flag of Sierra Leone.svg|border|20px|SLE]]" end
if x == 'Q1045' then return "[[File:Flag of Somalia.svg|border|20px|SOM]]" end
if x == 'Q1049' then return "[[File:Flag of Sudan.svg|border|20px|SUD]]" end
if x == 'Q1050' then return "[[File:Flag of Swaziland.svg|border|20px|SWZ]]" end
if x == 'Q1246' then return "[[File:Flag of Kosovo.svg|border|20px|KOS]]" end
if x == 'Q8646' then return "[[File:Flag of Hong Kong.svg|border|20px|HKG]]" end
if x == 'Q15180' then return "[[File:Flag of the Soviet Union.svg|border|20px|URS]]" end
if x == 'Q16957' then return "[[File:Flag of East Germany.svg|border|20px|GDR]]" end
if x == 'Q26988' then return "[[File:Flag of the Cook Islands.svg|border|20px|COK]]" end
if x == 'Q28513' then return "[[File:Flag of Austria-Hungary (1869-1918).svg|border|20px]]" end
if x == 'Q33946' then return "[[File:Flag of the Czech Republic.svg|border|20px|TCH]]" end
if x == 'Q34020' then return "[[File:Flag of Niue.svg|border|20px]]" end
if x == 'Q34266' then return "[[File:Flag of Russia.svg|border|20px|RU1]]" end
if x == 'Q36704' then return "[[File:Flag of SFR Yugoslavia.svg|border|20px|YUG]]" end
return ""
end
return p