]> git.mxchange.org Git - friendica.git/commitdiff
Remove whitespace clearing around code tags
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 14 Oct 2018 11:43:44 +0000 (07:43 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 14 Oct 2018 11:43:44 +0000 (07:43 -0400)
- Normalize inline code blocks to <code>

src/Content/Text/BBCode.php

index 66f4190b287eca731fe8b465dea18da5504b0feb..c903ee6945790fcd96e85c476af168c4ff124c91 100644 (file)
@@ -1265,9 +1265,6 @@ class BBCode extends BaseObject
                $text = preg_replace("/\s?\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "[share$1]$2[/share]", $text);
                $text = preg_replace("/\s?\[quote(.*?)\]\s?(.*?)\s?\[\/quote\]\s?/ism", "[quote$1]$2[/quote]", $text);
 
-               $text = preg_replace("/\n\[code\]/ism", "[code]", $text);
-               $text = preg_replace("/\[\/code\]\n/ism", "[/code]", $text);
-
                // when the content is meant exporting to other systems then remove the avatar picture since this doesn't really look good on these systems
                if (!$try_oembed) {
                        $text = preg_replace("/\[share(.*?)avatar\s?=\s?'.*?'\s?(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "\n[share$1$2]$3[/share]", $text);
@@ -1717,18 +1714,6 @@ class BBCode extends BaseObject
                        $text = Smilies::replace($text, false, true);
                }
 
-               // Replace inline code blocks
-               $text = preg_replace_callback("|(?!<br[^>]*>)<code>([^<]*)</code>(?!<br[^>]*>)|ism",
-                       function ($match) use ($simple_html) {
-                               $return = '<key>' . $match[1] . '</key>';
-                               // Use <code> for Diaspora inline code blocks
-                               if ($simple_html === 3) {
-                                       $return = '<code>' . $match[1] . '</code>';
-                               }
-                               return $return;
-                       }
-               , $text);
-
                // Unhide all [noparse] contained bbtags unspacefying them
                // and triming the [noparse] tag.