Module:UtilsMarkup/List

local p = {}

local utilsTable = require("Module:UtilsTable")

function list(prefix, subprefix, level) level = level or 0 local itemPrefix = "\n" .. prefix .. string.rep(subprefix or prefix, level) return function(items) local output = "" for i, item in ipairs(items) do			if utilsTable.isArray(item) then output = output .. list(prefix, subprefix, level + 1)(item) else output = output .. itemPrefix .. item end end return output end end

p.list = list("", ":") p.bulletList = list("*") p.numberList = list("#")

p.Documentation = { {		wip = true, name = "list", params = { {				name = "items", description = "The list items", }		},		returns = "A multiline string with each item on its own line.", cases = { {				args = { {} }, expected = "", },			{				args = { { "single item" } },				expected = "\nsingle item", },			{				args = { { "multiple", "items", "" }, },				expected = "\nmultiple\nitems\n" },			{				args = { {						"list", {							"with", {"nested", "items"}, "inside" },					},				},				expected = 					list					:with					::nested					::items					:inside },		}	} } return p