Module:Wikilink list
Jump to navigation
Jump to search
Documentation for this module may be created at Module:Wikilink list/doc
local p = {}
function p.exec(frame)
local args
-- If called via #invoke, use the args passed into the invoking template.
-- Otherwise, for testing purposes, assume args are being passed directly in.
if frame == mw.getCurrentFrame() then
args = frame:getParent().args
else
args = frame
end
local sep
if args[3] == nil then
sep = ","
else
sep = args[3]
end
local out = {}
for x in mw.text.gsplit(args[2], "%s*" .. sep .. "%s*") do
out[#out + 1] = "[[" .. x .. "]]"
end
local base = mw.html.create("")
if #out == 1 then
return base:wikitext(out[1])
end
return base:wikitext(
"* " .. mw.text.listToText(out,
"\n* ", "\n* "
)
)
end
return p