Skip to content

Commit 331fe7f

Browse files
authored
Merge pull request #64 from mhtamala/patch-3
Fixed minor bugs
2 parents 836f12a + cba4850 commit 331fe7f

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/Html/HtmlFormatter.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,8 @@ public function Format(Document $document)
4646
// Begin format
4747
$this->ProcessGroup($document->root);
4848
// Remove any final unclosed 'p' tag and return result:
49-
if (substr($this->output, -3) == "<p>") {
50-
return substr($this->output, 0, -3);
51-
} else {
52-
return $this->output;
53-
}
49+
return $this->openedTags['p'] ? substr($this->output, 0, -3) : $this->output;
50+
5451
}
5552

5653
protected function LoadFont(\RtfHtmlPhp\Group $fontGroup) {
@@ -431,8 +428,8 @@ protected function CloseTag($tag)
431428
}
432429
} else {
433430
$this->output .= "</{$tag}>";
434-
$this->openedTags[$tag] = false;
435431
}
432+
$this->openedTags[$tag] = false;
436433
}
437434
}
438435

0 commit comments

Comments
 (0)