Module:List

local utilsArg = require("Module:UtilsArg") local utilsMarkup = require("Module:UtilsMarkup") local utilsString = require("Module:UtilsString") local utilsTable = require("Module:UtilsTable")

local p = {}

function p.Main(frame) local args = utilsTable.merge(frame:getParent.args, frame.args) return p.main(args) end

local validate = utilsArg.validator({	type = {		enum = { "", "*", "#", "inline" },	}, })

function p.main(args) local errCategories = validate(args)

local type = args.type local delim = args.delim local items = utilsTable.map(args, utilsString.trim) items = utilsTable.filter(items, utilsString.notEmpty) if not type then return utilsMarkup.list(items) end if type == "*" then return utilsMarkup.bulletList(items) end if type == "#" then return utilsMarkup.numberList(items) end if type == "inline" and delim then return table.concat(items, mw.getCurrentFrame:preprocess(delim)) end return mw.text.listToText(items) .. (errCategories and utilsMarkup.categories(errCategories) or "") end

return p