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) if string.find(args[1], "^*+") then local li = string.gsub(args[1], "^(*+).+", "%1") args[1] = string.gsub(args[1], "^*+(.+)", "%1") if not args[2] then return li..""..args[1].." " else if string.find(args[2], "^*+") then return li..""..args[1].."\n"..args[2].." " else return li..""..args[1].."\n"..args[2].." " end end else if not args[2] then return "\n"..args[1].." " else return ""..args[1].."\n"..args[2].." " end end end return p