now preventing empty lines from gettin parsed into paragraphs

feature/tests
Michael Ochmann 3 years ago
parent e0800aa7cb
commit 0378f35b07
  1. 12
      src/Parser.php

@ -301,9 +301,19 @@ class Parser {
} }
private function buildParagraph(array $elms) : void { private function buildParagraph(array $elms) : void {
if (count($elms) < 1)
return;
$elm = $this->document->createElement("p"); $elm = $this->document->createElement("p");
foreach ($elms as $node) $i = 0;
foreach ($elms as $node) {
if (trim($node->textContent) === "")
continue;
$elm->appendChild($node); $elm->appendChild($node);
$i++;
}
if ($i < 1)
return;
$this->document->appendChild($elm); $this->document->appendChild($elm);
} }

Loading…
Cancel
Save