beautify-html
beautify-html copied to clipboard
Zero problem
Hey nice job!
But i got one fail...
<span>0</span>
will be...
<span></span>
why?
Probably a comparison, somewhere in the Beautifier. I bet passing the unformatted tag option = 'span', could resolve this particular issue for you.
I just popped in to let Ivanweiler know that after a couple days of half-writing my own DOMDocument parser, playing with a few 3rd-party libs, etc. This Lib is like the number 42. Thank you.
@GDCReXes issue found:
In print_token_raw
method replace the if ($text && $text !== '') {
with if ($text != null && $text !== '') {
private function print_token_raw($text)
{
if ($text != null && $text !== '') {
if (strlen($text) > 1 && $text[strlen($text) - 1] === "\n") {
// unformatted tags can grab newlines as their last character
$this->output[] = substr($text, 0, -1);
$this->print_newline(false, $this->output);
} else {
$this->output[] = $text;
}
}
for ($n = 0; $n < $this->newlines; $n++) {
$this->print_newline($n > 0, $this->output);
}
$this->newlines = 0;
}