From: Michael $1
', $text);
- $text = preg_replace("(\[h2\](.*?)\[\/h2\])ism", '$1
', $text);
- $text = preg_replace("(\[h3\](.*?)\[\/h3\])ism", '$1
', $text);
- $text = preg_replace("(\[h4\](.*?)\[\/h4\])ism", '$1
', $text);
- $text = preg_replace("(\[h5\](.*?)\[\/h5\])ism", '$1
', $text);
- $text = preg_replace("(\[h6\](.*?)\[\/h6\])ism", '$1
', $text);
+ $text = preg_replace("(\[h1\](.*?)\[\/h1\])ism", '
', $text); + $text = preg_replace("(\[h2\](.*?)\[\/h2\])ism", '
', $text); + $text = preg_replace("(\[h3\](.*?)\[\/h3\])ism", '
', $text); + $text = preg_replace("(\[h4\](.*?)\[\/h4\])ism", '
', $text); + $text = preg_replace("(\[h5\](.*?)\[\/h5\])ism", '
', $text); + $text = preg_replace("(\[h6\](.*?)\[\/h6\])ism", '
', $text); // Check for paragraph $text = preg_replace("(\[p\](.*?)\[\/p\])ism", '
$1
', $text); @@ -1466,27 +1466,27 @@ class BBCode ((strpos($text, "[/ol]") !== false) && (strpos($text, "[ol]") !== false)) || ((strpos($text, "[/ul]") !== false) && (strpos($text, "[ul]") !== false)) || ((strpos($text, "[/li]") !== false) && (strpos($text, "[li]") !== false))) && (++$endlessloop < 20)) { - $text = preg_replace("/\[list\](.*?)\[\/list\]/ism", '', $text); + $text = preg_replace("/\[list=\](.*?)\[\/list\]/ism", '
', $text); + $text = preg_replace("/\[list=1\](.*?)\[\/list\]/ism", '
', $text); + $text = preg_replace("/\[list=((?-i)i)\](.*?)\[\/list\]/ism", '
', $text); + $text = preg_replace("/\[list=((?-i)I)\](.*?)\[\/list\]/ism", '
', $text); + $text = preg_replace("/\[list=((?-i)a)\](.*?)\[\/list\]/ism", '
', $text); + $text = preg_replace("/\[list=((?-i)A)\](.*?)\[\/list\]/ism", '
', $text); + $text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '
', $text); + $text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '
', $text); $text = preg_replace("/\[li\](.*?)\[\/li\]/ism", '
', $text); - $text = preg_replace("/\[table border=1\](.*?)\[\/table\]/sm", '
', $text); + $text = preg_replace("/\[table border=0\](.*?)\[\/table\]/sm", '
', $text); - $text = str_replace('[hr]', '
', $text); if (!$for_plaintext) { $text = self::performWithEscapedTags($text, ['url', 'img', 'audio', 'video', 'youtube', 'vimeo', 'share', 'attachment', 'iframe', 'bookmark'], function ($text) { @@ -1520,7 +1520,7 @@ class BBCode } // Declare the format for [quote] layout - $QuoteLayout = '
$1'; + $QuoteLayout = '
$1
'; // Check for [quote] text // handle nested quotes diff --git a/tests/src/Content/Text/BBCodeTest.php b/tests/src/Content/Text/BBCodeTest.php index 4c1292344c..82fdcc3cbe 100644 --- a/tests/src/Content/Text/BBCodeTest.php +++ b/tests/src/Content/Text/BBCodeTest.php @@ -257,6 +257,14 @@ Karl Marx - Die ursprüngliche Akkumulation 'task-10886-deprecate-class' => [ 'expectedHTML' => '', 'text' => '[emoji=https://fedi.underscore.world/emoji/custom/custom/heart_nb.png]:heart_nb:[/emoji]', + ], + 'task-12900-multiple-paragraphs' => [ + 'expectedHTML' => '
This is a paragraph
with a line feed.
Second Chapter
', + 'text' => '[h1]Header[/h1][ul][*]One[*]Two[/ul]\n\nThis is a paragraph\nwith a line feed.\n\nSecond Chapter', + ], + 'task-12900-header-with-paragraphs' => [ + 'expectedHTML' => 'Some Chapter
', + 'text' => '[h1]Header[/h1]Some Chapter', ] ]; }