// Newlines and tabs.
'/[\n\t]+/' => ' ',
+ // Normalize <br> (remove leading/trailing whitespace)
+ '/\s*<br[^>]*>\s*/i' => '<br>',
+
// <script>s -- which strip_tags() supposedly has problems with.
'/<script(?:>|\s[^>]*>).*?<\/script\s*>/i' => '',
'/<div class=rte>(.+?)<\/div> ?/i' => '\\1<br>',
// <br>
- '/\s*<br[^>]*>\s*/i' => "\n"
+ '/<br[^>]*>/i' => "\n"
);
$regexp_callback = array(
}
}
- return trim($text);
+ return trim(rtrim($text), "\n");
}
/**
$text = stripslashes($this->_blockQuote($text));
}
- $text = trim(strip_tags($text));
+ $text = rtrim(strip_tags($text));
if ($this->_params['wrap']) {
$text = wordwrap($text, $this->_params['width'] - 2);
}
<li>And again a short line.</li>
</ul>
EOT;
+
echo Horde_Text_Filter::filter($html, 'html2text', array('width' => 50));
+echo "\n\n";
echo Horde_Text_Filter::filter($html, 'html2text', array('wrap' => false));
?>
a long line.
* And again a short line.
-
-
* This is a short line.
* This is a long line. This is a long line. This is a long line. This is a long line. This is a long line. This is a long line. This is a long line. This is a long line. This is a long line. This is a long line. This is a long line. This is a long line.
* And again a short line.