Module:List

local utilsArg = require("Module:UtilsArg") local utilsTable = require("Module:UtilsTable")

local p = {}

function p.main(frame) return p._main(utilsArg.getArgs(frame)) end

function p._main(args) local items = utilsTable.map(mw.text.trim, args) if #items == 0 then return args.default end if args.delim == "prosaic" then return mw.text.listToText(items) elseif args.delim == "bulleted" then return p.unorderedList(items) else local delim = (args.delim and args.delim:match("^'(.*)'$") or args.delim) or " " return table.concat(items, mw.text.decode(delim)) end end

function p.unorderedList(items) if #items == 0 then return "" end local list = "" for _, v in ipairs(items) do list = list .. "" .. v .. "" end list = list .. "" return list end

return p