local p = local yesno = require("Module:Yesno")function p.main(frame) if frame.args.text
nil then frame.args.text = mw.title.getCurrentTitle:getContent else frame.args.text = mw.title.new(frame.args.page):getContent end end return p._main(frame.args.text,yesno(frame.args.strict))endfunction p._main(text, strict) local out = "" local lastindent = "" local blanklines = "" for line in mw.text.gsplit(text, "\n") do local _, endindent = line:find("^[:*#]+") if endindent
0 then -- buffer blank lines or lines containing whitespace until we see the next non-blank line blanklines = blanklines .. line .. "\n" else -- reset state, emitting any blank lines out = out .. blanklines .. line .. "\n" blanklines = "" lastindent = "" end else local thisindent = line:sub(1, endindent) if endindent > #lastindent then thisindent = lastindent .. line:sub(#lastindent + 1, endindent) elseif endindent
1 and #lastindent
1 and #lastindent