Module:Flagg and Module:Flagg/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
p[''] = p.main |
Testing non-breaking spaces? I'll get back to this tomorrow |
||
Line 13: | Line 13: | ||
--Get input arguments |
--Get input arguments |
||
local args = require('Module:Arguments').getArgs(frame,{ |
local args = require('Module:Arguments').getArgs(frame,{ |
||
frameOnly = ((frame.args.frameonly or '') ~= ''), |
|||
function(key,value) |
valueFunc = function(key,value) |
||
if value then |
if value then |
||
value = mw.text.trim(value) |
value = mw.text.trim(value) |
||
Line 185: | Line 186: | ||
if mn == "*" and clink ~= flink then |
if mn == "*" and clink ~= flink then |
||
text = text:sub(1, -3) .. "\226\128\175*]]" end |
text = text:sub(1, -3) .. "\226\128\175*]]" end |
||
elseif mn=="l" then --display link target |
|||
text = flink=="" and name or "[["..flink..fsec.."|"..(args["name"] or flink).."]]" |
|||
elseif mn=="b" then --both prefix/suffix and normal country link |
elseif mn=="b" then --both prefix/suffix and normal country link |
||
local preflink = pref and (flink=="" and pref.." " or "[["..flink..fsec.."|"..pref.."]] ") or "" |
local preflink = pref and (flink=="" and pref.." " or "[["..flink..fsec.."|"..pref.."]] ") or "" |
||
Line 203: | Line 202: | ||
text = name |
text = name |
||
elseif mn=="a" then --abbr |
elseif mn=="a" then --abbr |
||
text = |
text = clink==name and name or "<abbr title='"..clink.."'>"..name.."</abbr>" |
||
else --country link (default) |
else --country link (default) |
||
text = clink=="" and name or "[["..clink..csec.."|"..name.."]]" |
text = clink=="" and name or "[["..clink..csec.."|"..name.."]]" |
||
Line 217: | Line 216: | ||
--Define separator |
--Define separator |
||
local separator = " |
local separator = " " |
||
if ms=="x" then --no separator |
if ms=="x" then --no separator |
||
separator = "" |
separator = "" |
||
Line 262: | Line 261: | ||
if iname==placeholder then |
if iname==placeholder then |
||
if require('Module:yesno')(args["noredlink"]) == false |
if require('Module:yesno')(args["noredlink"]) == false then |
||
⚫ | |||
if country ~= '' and data.alias == nil then |
|||
⚫ | |||
⚫ | |||
⚫ | |||
if args["noredlink"] == "notext" then |
|||
text = '' |
|||
end |
|||
end |
|||
end |
end |
||
if (args["missingcategory"] or '') ~= '' then |
if (args["missingcategory"] or '') ~= '' then |
||
Line 289: | Line 283: | ||
out = text |
out = text |
||
elseif ms=="x" or ms=="n" or ms=="l" then --no separator, non-breaking space, or line break |
elseif ms=="x" or ms=="n" or ms=="l" then --no separator, non-breaking space, or line break |
||
out = text.."<span class=\"flagicon\">"..separator..image.."</span>" |
out = text.."<span class=\"flagicon nowrap\">"..separator..image.."</span>" |
||
elseif ms=="t" then --table cell |
elseif ms=="t" then --table cell |
||
out = "style=\"text-align:"..(nalign or "left").."\"|"..text.."||style=\"text-align:"..(align or "center").."\"|<span class=\"flagicon\">"..image.."</span>" |
out = "style=\"text-align:"..(nalign or "left").."\"|"..text.."||style=\"text-align:"..(align or "center").."\"|<span class=\"flagicon\">"..image.."</span>" |
||
else --fixed-width span box (default) |
else --fixed-width span box (default) |
||
local width = args["width"] or args["w"] or require("Module:Flaglist").luawidth(size) |
local width = args["width"] or args["w"] or require("Module:Flaglist").luawidth(size) |
||
out = text.." |
out = text.."<span class=\"nowrap\"> <span class=\"flagicon\" style=\"display:inline-block;width:"..width.."px;text-align:"..(align or "right").."\">"..image.."</span></span>" |
||
end |
end |
||
else --image left of name |
else --image left of name |
||
Line 300: | Line 294: | ||
out = text |
out = text |
||
elseif ms=="x" or ms=="n" or ms=="l" then --no separator, non-breaking space, or line break |
elseif ms=="x" or ms=="n" or ms=="l" then --no separator, non-breaking space, or line break |
||
out = "<span class=\"flagicon\">"..image..separator.."</span>"..text |
out = "<span class=\"flagicon nowrap\">"..image..separator.."</span>"..text |
||
elseif ms=="t" then --table cell |
elseif ms=="t" then --table cell |
||
out = "style=\"text-align:"..(align or "center")..";\"|<span class=\"flagicon\">"..image.."</span>||style=\"text-align:"..(nalign or "left").."\"|"..text |
out = "style=\"text-align:"..(align or "center")..";\"|<span class=\"flagicon\">"..image.."</span>||style=\"text-align:"..(nalign or "left").."\"|"..text |
||
else --fixed-width span box (default) |
else --fixed-width span box (default) |
||
local width = nopx(args["width"] or args["w"]) or require("Module:Flaglist").luawidth(size) |
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:"..(align or "left").."\">"..image.."</span> |
out = "<span class=\"flagicon nowrap\" style=\"display:inline-block;width:"..width.."px;text-align:"..(align or "left").."\">"..image.." </span>"..text |
||
end |
end |
||
end |
|||
if string.find(me,"w") then --avoid wrapping |
|||
out = "<span class=\"nowrap\">"..out.."</span>" |
|||
end |
end |
||
Line 326: | Line 317: | ||
end |
end |
||
p[''] = p.main |
|||
return p |
return p |