Module:NewTableList

local p = {}

p.tableList = function(frame) -- https://stackoverflow.com/questions/1426954/split-string-in-lua function split (inputstr, sep) if sep == nil then sep = "%s" end local t={} for str in string.gmatch(inputstr, "([^"..sep.."]+)") do           table.insert(t, str) end return t	end -- use multiple columns for longer lists (more than 20 models), first we need to calculate how many elements local count = 0 for i, arg in ipairs(frame.args) do		count = count + #split(arg, ";") if string.len(string.gsub(arg, "%s", "")) > 0 then count = count - 1 end end local style = "" if count > 20 then style = " style='column-width: 15em; column-count: 10;'" end local result = "" result = result .. " "	for i, arg in ipairs(frame.args) do		if string.len(arg) > 0 then local argSplit = split(arg, ";") local brand = table.remove(argSplit, 1) -- if the last split element is empty, that means there was a trailing ';', so we can remove the last element if #string.gsub(argSplit[#argSplit], "%s", "") == 0 then table.remove(argSplit) end result = result .. " "			result = result .. "'''" .. brand .. "'''\n" for j = 1, #argSplit do				local model = string.gsub(argSplit[j], "\n", " ") if j > 1 then result = result .. "\n" end result = result .. "* " .. model .. "\n" end result = result .. " "		end end result = result .. " "	return result end

return p