Content deleted Content added
Converts "Flag of " in a variable in order to accept images that don't follow this name schema |
Supporting label parameter, and adding a "?" fallback flag for variant / label flags not found in FlagTranslations |
||
Line 1:
local p = {}
-- Loading the flag translations module --
local translations = mw.loadData("Module:Sandbox/QuimGil/FlagTranslations")
flagOf = "Flag_of_"▼
-- Assigning the parameter to a flag and a link
Line 44 ⟶ 47:
end
-- Variant check for historical flags --
if territory.args[
variant = territory.args[
commonsName = translations.variant[commonsName .. "|" .. variant]
flagOf=""
end▼
-- Label check --
if territory.args[2] ~= "{{{2}}}" then
variant = territory.args[2]
commonsName = translations.variant[commonsName .. "|" .. variant]
flagOf = ""
end
-- Fallback for non-identified variant/label flags --
if commonsName == nil then
commonsName = "Flag of None"
end
Line 65 ⟶ 81:
end
-- Checking whether a size parameter has been introduced, otherwise set default
if territory.args[
size = territory.args[
else
size = defaultSize(commonsName)
end
return '[[File:
▲-- Converts "Flag of " in a variable in order to accept images that don't follow this name schema
▲ flagOf = "Flag_of_"
▲return '[[File:Flag_of_' .. commonsName .. '.svg|' .. border .. 'link=' .. link .. '|'.. size .. ']]'
end
return p
|