Content deleted Content added
Here too |
Fix border; consistent whitespace |
||
Line 24:
function emp2nil(x)
end
function space2emp(x)
end
function nopx(x)
end
Line 68:
local pref = args["pref"]
local suff = args["suff"] or asuf
if not pref and not suff then --Default prefix
end
local yn_map = {[""]=0; ["0"]=0; ["no"]=0; ["n"]=0; ["1"]=1; ["yes"]=1; ["y"]=1}
Line 100:
local image_map = {[""]=placeholder; ["none"]=placeholder; ["blank"]=placeholder}
if pimage then --Remove namespace
end
local iname = image_map[pimage] or pimage
Line 108:
local size_map = {xs="12x8px"; s="17x11px"; m="23x15px"; l="32x21px"; xl="46x30px"}
if size==nil or string.find(size,"^%d*x?%d+px$")
elseif string.find(size,"^%d*x?%d+$")
end
local border = frame:getParent().args["border"] or frame.args["border"]
Line 124:
if yn_map[border]==0 then border = "" else border = "|border" end
else
if autoborder and autoborder~="border" then border = "" else border = "|border" end end
end
Line 130 ⟶ 131:
local am = ""
if args["alt"] or string.find(me,"a") then
end
Line 137 ⟶ 138:
local text = args["text"]
if not text then
if mn=="x" then --no text
elseif mn=="p" or mn=="f" then --prefix/suffix link
elseif mn=="b" then --both prefix/suffix and normal country link
if pref and suff then
▲ then text = "[["..flink.."|"..pref.."]] "..nthe.."[["..clink.."|"..name.."]] [["..flink.."|"..suff.."]]"
elseif
▲ then text = "[["..flink.."|"..pref.."]] "..nthe.."[["..clink.."|"..name.."]]"
▲ then text = nthe.."[["..clink.."|"..name.."]] [["..flink.."|"..suff.."]]"
else
text = nthe.."[["..clink.."|"..name.."]]"
end
elseif mn=="d" then --data template
if require('Module:Redirect').luaIsRedirect("Template:Country data "..country) then
text = "[[Template:Country data "..country.."|"..name.."]]" end
elseif mn=="u" then --unlinked
else --country link (default)
text = "[["..clink.."|"..name.."]]"
end
end
Line 168 ⟶ 169:
local ilink = args["ilink"]
if not ilink then
if mi=="x" or (iname==placeholder and pimage~=placeholder) then --no image/invisible image
elseif mi=="i" then --image page link
elseif mi=="c" then --country link
elseif mi=="p" or mi=="f" then --prefix/suffix link
elseif mi=="d" then --data template
if require('Module:Redirect').luaIsRedirect("Template:Country data "..country) then
ilink = "|link=Template:Country data "..country end
else --unlinked (default)
ilink = "|link="
end
end
Line 193 ⟶ 195:
local align_map = {left="left", l="left", center="center", centre="center", c="center", middle="center", m="center", right="right", r="right"}
local out
if string.find(me,"r") then
if (ms=="x" and mi=="x") or (string.find(me,"o") and iname==placeholder and pimage~=placeholder) then --name only
elseif ms=="x" then --no separator
elseif ms=="n" then --non-breaking space
elseif ms=="l" then --line break
elseif ms=="t" then --table cell
else --fixed-width span box (default)
local width = args["width"] or args["w"] or require("Module:Flaglist/size").luawidth(size)
out = text.."<span class=\"flagicon\" style=\"display:inline-block;width:"..width.."px;text-align:"..(align_map[align] or "right")..";\">"..image.."</span>"
end
else --image left of name
if (ms=="x" and mi=="x") or (string.find(me,"o") and iname==placeholder and pimage~=placeholder) then --name only
elseif ms=="x" then --no separator
elseif ms=="n" then --non-breaking space
elseif ms=="l" then --line break
elseif ms=="t" then --table cell
else --fixed-width span box (default)
local width = nopx(args["width"] or args["w"]) or require("Module:Flaglist/size").luawidth(size)
out = "<span class=\"flagicon\" style=\"display:inline-block;width:"..width.."px;text-align:"..(align_map[align] or "left")..";\">"..image.."</span>"..text
end
end
if string.find(me,"w") then --avoid wrapping
end
--Tracking categories
local cat = ""
if pimage and not image_map[pimage] and country~="" and data["flag alias"] and not args.demo then
end
|