Module:Sandbox/BrandonXLF/3: Difference between revisions

Content deleted Content added
No edit summary
Attempt to make link to country
Line 12:
 
if string.match(image, "(.-)%.(.*)") then
file = frame:expandTemplate{title = "flagicon image", args = { image } }
elseif string.match(image, ".-%s%(.-%)") then
local country, var = string.match(image,"(.-)%s%((.-)%)")
file = frame:expandTemplate{title = "flagdeco", args = { country, var } }
else
file = frame:expandTemplate{title = "flagdeco", args = { image } }
end
 
return file
end
 
function getCountry(country)
local title = mw.title.new(country)
if not title or not title.exists then
return country
end
return '[[' .. country .. ']]'
end
 
Line 34 ⟶ 44:
table.insert(entries, {
image = image,
country = getCountry(args[i + 1]),
post = args[i + 2] and ' (' .. args[i + 2] .. ')' or ''
})