Module:List

local p = {} local h = {}

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

function p.Main(frame) local args, err = utilsArg.parse(frame:getParent.args, p.Templates.List) local categories = err and err.categoryText or "" return h.printList(args.entries) end

function h.printList(items) if items == nil or #items == 0 then return "" end if #items == 1 then -- assume list items are delimited by commas instead of pipes local input = items[1] input = string.gsub(input, ",%s*$", "") -- strip dangling comma if present items = utilsString.split(input, '%s*,%f[^,%d]%s*') -- %f[^,%d] is so we don't split numbers on their thousands separator (e.g., 1,500) end return utilsMarkup.list(items) end

p.Templates = { List = { desc = "Renders each list entry on a separate line without any list markers such as bullets or numbers", format = "inline", params = { ["..."] = {				name = "entries", placeholder = "entry", type = "content", desc = "List items. Can be any wikitext.", trim = true, nilIfEmpty = true, },		},	}, }

return p