From 96ed7525b733111dbeca2cd672f85188ce369fef Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 16 Sep 2018 09:05:54 -0400 Subject: [PATCH] Improve whitespace display from/to BBCode/HTML --- src/Content/Text/BBCode.php | 2 +- src/Content/Text/HTML.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index b403b1f349..d0f512ce13 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -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); } diff --git a/src/Content/Text/HTML.php b/src/Content/Text/HTML.php index 844b111ca1..9a9f24f97f 100644 --- a/src/Content/Text/HTML.php +++ b/src/Content/Text/HTML.php @@ -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 -- 2.39.5