$/=undef;open+A,"+<".shift;$_=<A>;s/(<[^<>]+>)/\n$1\n/g;seek A,0,0;$r='(?:[\t\n\s]+)?';for(split/$r\n$r/){$t--if/<\/[^bcop ]/i;$_="\t"x$t.$_;$t++if/<[^\/bci-p!]/i;print A"$_\n"}close(A)
In reply to HTML Cleanup by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |