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 if collapsed == 0 or	collapsed == "no" or	collapsed == "n" or	collapsed == "false" 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 local list_count = string.gsub(args[1], "^(*+).+", "%1") args[1] = string.gsub(args[1], "^*+(.+)", "%1") if not args[2] then result = list_count.." "..args[1].." " else 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]..""..args[2].." " end end end return result end return p