Module:CountryData: Difference between revisions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode |
||
| Line 544: | Line 544: | ||
end | end | ||
local | local listItems = {} | ||
for _, | for _, countryName in ipairs(countries) do | ||
local normalized = CountryData.normalizeCountryName( | local normalized = CountryData.normalizeCountryName(countryName) | ||
if normalized ~= "(Unrecognized)" then | if normalized ~= "(Unrecognized)" then | ||
table.insert( | local countryRegion = CountryData.getRegionByCountry(normalized) | ||
local regionClass = getRegionClass(countryRegion) | |||
table.insert(listItems, string.format("<li class=\"%s\">%s</li>", regionClass, normalized)) | |||
end | end | ||
end | end | ||
if # | if #listItems > 0 then | ||
return string.format("<ul class=\"template-list template-list-country\">%s</ul>", table.concat(listItems, "")) | return string.format("<ul class=\"template-list template-list-country\">%s</ul>", table.concat(listItems, "")) | ||
end | end | ||