Module:Collapse

local getArgs = require('Module:Arguments').getArgs local p = {}

function p.main(frame) local args = getArgs(frame) return p._main(args) end

function p._main(args) local collapsed = args["collapsed"] or nil local result = nil local collapsed_v = { ["no"] = true, ["n"] = true, ["0"] = true }   if collapsed_v[collapsed] then class = "mw-collapsible" else class = "mw-collapsible mw-collapsed" end attributes = "class=\"collapser "..class.."\"".."data-expandtext=\"►\" data-collapsetext=\"▼\""

if string.find(args[1], "^*+") then if not args[2] then result = "  \n"..args[1].." " else local list_count = string.gsub(args[1], "^(*+).+", "%1") args[1] = string.gsub(args[1], "^*+(.+)", "%1") if string.find(args[2], "^*+") then result = list_count.." "..args[1].."\n"..args[2].." " else result = list_count.." "..args[1]..""..args[2].." " end end else if not args[2] then result = " "..args[1].." " else if string.find(args[2], "^*+") then result = " "..args[1].."\n"..args[2].." " else result = " "..args[1].."\n"..args[2].." " end end end return "\n"..result end return p