From: Michael M Slusarz Date: Thu, 25 Feb 2010 05:47:54 +0000 (-0700) Subject: Optimizations to html2text output X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a7c4277e4a82a13c0a5d62967cd0ee842b22830d;p=horde.git Optimizations to html2text output --- diff --git a/framework/Text_Filter/lib/Horde/Text/Filter/Html2text.php b/framework/Text_Filter/lib/Horde/Text/Filter/Html2text.php index 460d0a713..90f0c349b 100644 --- a/framework/Text_Filter/lib/Horde/Text/Filter/Html2text.php +++ b/framework/Text_Filter/lib/Horde/Text/Filter/Html2text.php @@ -112,12 +112,9 @@ class Horde_Text_Filter_Html2text extends Horde_Text_Filter_Base $text = $this->_node($doc, $doc); } - /* Strip HTML tags and convert HTML entities. */ - $text = html_entity_decode($text, ENT_QUOTES, 'UTF-8'); - /* Bring down number of empty lines to 2 max, and remove trailing * ws. */ - $text = preg_replace(array("/\n[[:space:]]+\n/", "/[\n]{3,}/", "/ +\n/"), array("\n\n", "\n\n", "\n"), $text); + $text = preg_replace(array("/\s*\n{3,}/", "/ +\n/"), array("\n\n", "\n"), $text); /* Wrap the text to a readable format. */ if ($this->_params['wrap']) { @@ -304,7 +301,7 @@ class Horde_Text_Filter_Html2text extends Horde_Text_Filter_Base if (!$child->nextSibling) { $tmp = rtrim($tmp); } - $out .= $tmp; + $out .= html_entity_decode($tmp, ENT_QUOTES, 'UTF-8'); } } }