summaryrefslogtreecommitdiff
path: root/program/lib/html2text.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-05-03 07:16:52 +0000
committeralecpl <alec@alec.pl>2011-05-03 07:16:52 +0000
commit4d7fbd508aa50df367f9f055d95f22b697dab5f9 (patch)
tree65e03acde9044440aa1140cd738ada823af2bfe6 /program/lib/html2text.php
parent125894d35d5d961ff34dc17134eaf21da73115b3 (diff)
- Remove leading empty lines (can be produced by eg. P tag on the beginning)
Diffstat (limited to 'program/lib/html2text.php')
-rw-r--r--program/lib/html2text.php3
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.