]> git.mxchange.org Git - friendica.git/commitdiff
Improve whitespace display from/to BBCode/HTML
authorHypolite Petovan <mrpetovan@gmail.com>
Sun, 16 Sep 2018 13:05:54 +0000 (09:05 -0400)
committerHypolite Petovan <mrpetovan@gmail.com>
Sun, 16 Sep 2018 13:05:54 +0000 (09:05 -0400)
src/Content/Text/BBCode.php
src/Content/Text/HTML.php

index b403b1f349e1a8a0ef8a04346790a29f75840cd1..d0f512ce1371e453298353c140617d5f13401abe 100644 (file)
@@ -348,7 +348,7 @@ class BBCode extends BaseObject
         */
        public static function toPlaintext($text, $keep_urls = true)
        {
-               $naked_text = preg_replace('/\[(.+?)\]/','', $text);
+               $naked_text = preg_replace('/\[(.+?)\]\s*/','', $text);
                if (!$keep_urls) {
                        $naked_text = preg_replace('#https?\://[^\s<]+[^\s\.\)]#i', '', $naked_text);
                }
index 844b111ca1bf94cd0165e02af54bc9e10b7a66e9..9a9f24f97f48e1a5542836817d05f1059fcad279 100644 (file)
@@ -131,7 +131,7 @@ class HTML
                                        $prefix = '[code=' . $matches[1] . ']';
                                }
 
-                               $codeblocks[] = $prefix . trim($matches[2]) . '[/code]';
+                               $codeblocks[] = $prefix . PHP_EOL . trim($matches[2]) . PHP_EOL . '[/code]';
                                return $return;
                        },
                        $message