Jump to content

Module:Flagg and Module:Flagg/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
Content deleted Content added
p[''] = p.main
 
Add frameOnly
 
Line 13: Line 13:


--Get input arguments
--Get input arguments
local args = require('Module:Arguments').getArgs(frame,{valueFunc =
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 = name==country and (clink==country and country or "<abbr title='"..clink.."'>"..country.."</abbr>") or ("<abbr title='"..name.."'>"..country.."</abbr>")
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 262: Line 261:


if iname==placeholder then
if iname==placeholder then
if require('Module:yesno')(args["noredlink"]) == false or args["noredlink"] == "notext" then
if require('Module:yesno')(args["noredlink"]) == false then
iname = ''
if country ~= '' and data.alias == nil then
image = "[[:Template:Country data "..country.."]]"
iname = ''
image = "[[:Template:Country data "..country.."]]"
if args["noredlink"] == "notext" then
text = ''
end
end
end
end
if (args["missingcategory"] or '') ~= '' then
if (args["missingcategory"] or '') ~= '' then
Line 326: Line 320:


end
end

p[''] = p.main


return p
return p