Module:Flags: Difference between revisions

Content deleted Content added
Supporting text= aka possibility to add a text and define the link
Introducing customizable link
Line 7:
local translations = mw.loadData("Module:Flags/LocaleData")
local master = mw.loadData("Module:Flags/MasterData")
 
-- Assigning the parameter to a flag and a link
function p.flag(territory)
Line 125:
end
-- Customizing the link
openBrackets = "[["
closeBrackets = "]]"
if territory.args[5] ~== "{{{text}}}" then
flagLink = ""
textLink = ""
openBrackets = ""
closeBrackets = ""
text =elseif territory.args[5] ~= "{{{link}}}" then
textflagLink = " [[" .. territory.args[5] .. "]]"
textLink = territory.args[5] .. "|"
else flagLink = link
textLink = link .. "|"
end
-- Text in addition to flag
textif territory.args[6] == "" then
text = " " .. openBrackets .. link .. closeBrackets
if territory.args[5] ~= "{{{text}}}" then
elseif territory.args[6] ~= "{{{text}}}" then
text = territory.args[5]
if text == " " then.. textopenBrackets =.. " [["textLink .. linkterritory.args[6] .. "]]"closeBrackets
else linktext = text""
text = " [[" .. territory.args[5] .. "]]"
end
end
 
return '[[File:' .. flagOf .. commonsName .. '.svg|' .. border .. 'link=' .. linkflagLink .. '|'.. size .. ']]' .. text
end
return p