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

function p.main(args) local errCategories = utilsArg.validate(args, {			type = {			enum = { "", "*", "#", "inline" },		},	})

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

-- TODO: WIP p.Templates = { List = { purpose = "This outputs bits of text in lists of various formats. It is important that this be used instead of makings lists instead of  so that the output HTML is semantically meaningful to screen readers (that is to say, easier for the visually impaired to navigate.)", params = { _rest = {} }	} }

return p