summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2015-04-09 10:11:00 +0200
committerAleksander Machniak <alec@alec.pl>2015-04-09 10:11:00 +0200
commit53cbebf8ade5d9994479370cc78ac4e10c23c887 (patch)
treeff7a1632f007937712991389aaa5a442e50bf5b7
parentaa38c512fb7634f51bfa168476105dd071f4bd35 (diff)
Fix handling spaces after <br> on html2text conversion
-rw-r--r--program/lib/Roundcube/rcube_html2text.php2
-rw-r--r--tests/Framework/Html2text.php5
2 files changed, 6 insertions, 1 deletions
diff --git a/program/lib/Roundcube/rcube_html2text.php b/program/lib/Roundcube/rcube_html2text.php
index 284e50dca..00a59a7f3 100644
--- a/program/lib/Roundcube/rcube_html2text.php
+++ b/program/lib/Roundcube/rcube_html2text.php
@@ -142,7 +142,7 @@ class rcube_html2text
'/<script[^>]*>.*?<\/script>/i', // <script>s -- which strip_tags supposedly has problems with
'/<style[^>]*>.*?<\/style>/i', // <style>s -- which strip_tags supposedly has problems with
'/<p[^>]*>/i', // <P>
- '/<br[^>]*>/i', // <br>
+ '/<br[^>]*>\s*/i', // <br>
'/<i[^>]*>(.*?)<\/i>/i', // <i>
'/<em[^>]*>(.*?)<\/em>/i', // <em>
'/(<ul[^>]*>|<\/ul>)/i', // <ul> and </ul>
diff --git a/tests/Framework/Html2text.php b/tests/Framework/Html2text.php
index 76b1f16cd..dee767057 100644
--- a/tests/Framework/Html2text.php
+++ b/tests/Framework/Html2text.php
@@ -46,6 +46,11 @@ class rc_html2text extends PHPUnit_Framework_TestCase
'in' => chr(0x002).chr(0x003),
'out' => chr(0x002).chr(0x003),
),
+ 7 => array(
+ 'title' => 'Remove spaces after <br>',
+ 'in' => 'test<br> test',
+ 'out' => "test\ntest",
+ ),
);
}