local p =
local Navbox = require("Module:Navbox")local country =
local function li(text) local li = mw.html.create("li") li :wikitext(text) :done return tostring(li)end
local function linktarget(x, y) if y ~= nil and y
local function links(args1, args2, argsprefix, argssuffix, sorter, redlinks, override) local list = local prefix = (args1 or argsprefix or "") .. " " local suffix = args2 or argssuffix or "" for x, y in pairs(sorter) do local target = nil if redlinks then if override[y] then target = override[y] elseif y
"Palestine" then if mw.title.new(prefix..country[y][1]..suffix).exists then target = prefix..country[y][1]..suffix else target = prefix..y..suffix end else target = prefix..linktarget(y, country[y][1])..suffix end else -- noredlinks if override[y] then if mw.title.new(override[y]).exists then target = override[y] end elseif mw.title.new(prefix..linktarget(y, country[y][1])..suffix).exists then target = prefix..linktarget(y, country[y][1])..suffix elseif y
"Palestine" then if mw.title.new(prefix..y..suffix).exists then target = prefix..y..suffix end end end if target then table.insert(list, li(""..y.."")) end end return listend
function p.main(frame) local pframe = frame:getParent local config = frame.args local args = pframe.args return p._main(args)end
function p._main(args) local state, titlemid, title, group1 if mw.title.getCurrentTitle
nil or args.suffix
-- parse link overrides, e.g. |link_United_States=Foo sets override["United States"] = "Foo" local override = for k,v in pairs(args) do local country = mw.ustring.match(k, "^link_(.*)") if country then country = mw.ustring.gsub(country, "_", " ") override[country] = v end end local redlinks = args.noredlinks
return p