diff options
author | alecpl <alec@alec.pl> | 2011-05-03 07:16:52 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2011-05-03 07:16:52 +0000 |
commit | 4d7fbd508aa50df367f9f055d95f22b697dab5f9 (patch) | |
tree | 65e03acde9044440aa1140cd738ada823af2bfe6 | |
parent | 125894d35d5d961ff34dc17134eaf21da73115b3 (diff) |
- Remove leading empty lines (can be produced by eg. P tag on the beginning)
-rw-r--r-- | program/lib/html2text.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/program/lib/html2text.php b/program/lib/html2text.php index 48df4592c..1ab16055b 100644 --- a/program/lib/html2text.php +++ b/program/lib/html2text.php @@ -515,6 +515,9 @@ class html2text $text = preg_replace("/\n\s+\n/", "\n\n", $text); $text = preg_replace("/[\n]{3,}/", "\n\n", $text); + // remove leading empty lines (can be produced by eg. P tag on the beginning) + $text = preg_replace('/^\n+/', '', $text); + // Wrap the text to a readable format // for PHP versions >= 4.0.2. Default width is 75 // If width is 0 or less, don't wrap the text. |