diff --git a/include/html2text.php b/include/html2text.php index 51137d002ea4440549c988d35b46fdc3cfc6d855..944c62f19b2472bed206b8bfeed6b3e8219d241e 100644 --- a/include/html2text.php +++ b/include/html2text.php @@ -346,8 +346,9 @@ class HtmlHrElement extends HtmlBlockElement { class HtmlHeadlineElement extends HtmlBlockElement { function render($width, $options) { - $headline = parent::render($width, $options) . "\n"; $line = false; + if (!($headline = parent::render($width, $options))) + return ""; switch ($this->node->nodeName) { case 'h1': case 'h2': @@ -357,9 +358,10 @@ class HtmlHeadlineElement extends HtmlBlockElement { case 'h4': $line = '-'; break; + default: + return $headline; } - if ($line) - $headline .= str_repeat($line, strpos($headline, "\n", 1) - 1) . "\n"; + $headline .= "\n" . str_repeat($line, strpos($headline, "\n", 1) - 1) . "\n"; return $headline; } }