Module:List
Jump to navigation
Jump to search
Documentation for this module may be created at Module:List/doc
local p = {}
local function defArg(arg)
return arg and mw.text.trim(arg) ~= ''
end
function p.main(frame)
return p.call(frame:getParent().args)
end
function p.call(args)
local code = ''
local nowrap = defArg(args.nowrap)
local sep = '•'
local spacebefore = true
local spaceafter = true
if defArg(args.nospace) then
spacebefore = false
spaceafter = false
else
if defArg(args.nospacebefore) then
spacebefore = false
end
if defArg(args.nospaceafter) then
spaceafter = false
end
end
if defArg(args.sep) then
sep = mw.text.trim(args.sep)
elseif defArg(args.nosep) then
sep = ''
end
if spacebefore then
sep = ' ' .. sep
end
if spaceafter then
sep = sep .. ' '
end
for i, arg in ipairs(args) do
if defArg(arg) then
arg = mw.text.trim(arg)
if nowrap then
arg = '<span style="white-space:nowrap;">' .. arg .. '</span>'
end
if code == '' then
code = code .. arg
else
code = code .. sep .. arg
end
end
end
return code
end
return p