Content deleted Content added
Use CountryData.getcachedtable |
Merge in changes from sandbox |
||
Line 70:
local pref = args["pref"]
local suff = args["suff"] or asuf
local suff2 = args["suff2"]
if not pref and not suff then --Default prefix
pref = "Flag of"
Line 80 ⟶ 82:
local flink = args["plink"] or args["flink"] or alink
or clink=="" and "" or space2emp((pref or "").." ")..fthe..clink..space2emp(" "..(suff or ""))
local flink2 = args["plink2"] or args["flink2"] or clink=="" and "" or space2emp((pref2 or "").." ")..fthe..clink..space2emp(" "..(suff2 or ""))
local fsec = args["psection"] or args["section"]
local csec = args["csection"] or args["section"]
fsec = fsec and "#"..fsec or ""
fsec2 = fsec2 and "#"..fsec2 or ""
csec = csec and "#"..csec or ""
if string.find(me,"f") then
if mw.title.new( flink ).exists == false then
if flink2 ~= flink and mw.title.new ( flink2 ).exists == true then
flink = clink▼
flink = flink2
fsec = fsec2
else
▲ flink = clink
end
end
end
Line 148 ⟶ 158:
if mn=="x" then --no text
text = ""
elseif mn=="p" or mn=="f" or mn == "*" then --prefix/suffix link
text = flink=="" and name or "[["..flink..fsec.."|"..name.."]]"
-- By the principle of least surprise, there should be some
-- indication that the link [[X of Country|Country]] does not
-- go to [[Country]].
if mn == "*" and clink ~= flink then
text = text:sub(1, -3) .. "\226\128\175*]]" end
elseif mn=="b" then --both prefix/suffix and normal country link
local preflink = pref and (flink=="" and pref.." " or "[["..flink..fsec.."|"..pref.."]] ") or ""
Line 215 ⟶ 230:
--Combine image and name with separator
▲ local align = args["align"] or args["al"]
▲ local nalign = args["nalign"] or args["nal"]
local align_map = {left="left", l="left", center="center", centre="center", c="center", middle="center", m="center", right="right", r="right"}
local align = align_map[args["align"] or args["al"]]
local nalign = align_map[args["nalign"] or args["nal"]]
local out
if string.find(me,"r") then
Line 230 ⟶ 245:
out = text.."<span class=\"flagicon\"><br/>"..image.."</span>"
elseif ms=="t" then --table cell
out = "style=\"text-align:"..(
else --fixed-width span box (default)
local width = args["width"] or args["w"] or require("Module:Flaglist").luawidth(size)
out = text.." <span class=\"flagicon\" style=\"display:inline-block;width:"..width.."px;text-align:"..(
end
else --image left of name
Line 245 ⟶ 260:
out = "<span class=\"flagicon\">"..image.."<br/></span>"..text
elseif ms=="t" then --table cell
out = "style=\"text-align:"..(
else --fixed-width span box (default)
local width = nopx(args["width"] or args["w"]) or require("Module:Flaglist").luawidth(size)
out = "<span class=\"flagicon\" style=\"display:inline-block;width:"..width.."px;text-align:"..(
end
end
if string.find(me,"w") then --avoid wrapping
out = "<span class=\"nowrap\">"..out.."</span>"
end
-- align in table
if me:find("t") then
out = 'style="text-align:'..(align or 'left')..'"|'..out
end
|