Aleksander Machniak
2015-04-09 53cbebf8ade5d9994479370cc78ac4e10c23c887
Fix handling spaces after <br> on html2text conversion
2 files modified
7 ■■■■ changed files
program/lib/Roundcube/rcube_html2text.php 2 ●●● patch | view | raw | blame | history
tests/Framework/Html2text.php 5 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_html2text.php
@@ -142,7 +142,7 @@
        '/<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>
tests/Framework/Html2text.php
@@ -46,6 +46,11 @@
                'in'    => chr(0x002).chr(0x003),
                'out'   => chr(0x002).chr(0x003),
            ),
            7 => array(
                'title' => 'Remove spaces after <br>',
                'in'    => 'test<br>  test',
                'out'   => "test\ntest",
            ),
        );
    }