local p =
function p._current out = for k, v in pairs(mw.site.interwikiMap("local")) do if v.isCurrentWiki then table.insert(out, k) end end return outend
function p._map(isLocal) isLocal = isLocal and "local" or nil out = for k, v in pairs(mw.site.interwikiMap(isLocal)) do table.insert(out, k) end return outend
function p._isCurrentIW(title) for _, v in ipairs(p._current) do pattern = "^:?" .. v .. ":" if mw.ustring.match(title, pattern) then return true end end return falseend
function p._isValidIW(title, isLocal) for _, v in ipairs(p._map(isLocal)) do pattern = "^:?" .. v .. ":" if mw.ustring.match(title, pattern) then return true end end return falseend
local function current(args) return table.concat(p._current, (args.sep or ", "))end
local function map(args) return table.concat(p._map(args["local"]), (args.sep or ", "))end
local function isCurrentIW(args) return p._isCurrentIW((args[1] or ""))end
local function ifCurrentIW(args) if p._isCurrentIW((args[1] or "")) then return args[2] or "" else return args[3] or "" endend
local function isValidIW(args) return p._isValidIW((args[1] or ""), args["local"])end
local function ifValidIW(args) if p._isValidIW((args[1] or ""), args["local"]) then return args[2] or "" else return args[3] or "" endend
local function makeWrapper(func) return function (frame) -- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. local origArgs if frame
'sep' then if k
true) else args[k] = v end end end return func(args) endend
return