diff options
author | Mario <mario@mariovavti.com> | 2024-03-21 11:37:55 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-03-21 11:37:55 +0000 |
commit | 2dc1adf0910dfb96f660374c683f3c84d0250c7a (patch) | |
tree | 6e232a6c54574e42b56b863ec798c81b7dd33a57 | |
parent | 6a3d37205007888a17ce46892190f7977f387b5d (diff) | |
parent | 371b8440c3a57103bfdfe15373b025ee1f4a73d3 (diff) | |
download | volse-hubzilla-2dc1adf0910dfb96f660374c683f3c84d0250c7a.tar.gz volse-hubzilla-2dc1adf0910dfb96f660374c683f3c84d0250c7a.tar.bz2 volse-hubzilla-2dc1adf0910dfb96f660374c683f3c84d0250c7a.zip |
Merge branch 'dev' into 9.0RC
-rw-r--r-- | include/bbcode.php | 22 | ||||
-rw-r--r-- | tests/unit/includes/BBCodeTest.php | 6 | ||||
-rw-r--r-- | view/theme/redbasic/css/sample.scss | 4 |
3 files changed, 20 insertions, 12 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 86944ba60..d4aeb369f 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -1440,32 +1440,32 @@ function bbcode($text, $options = []) { // Check for h1 if (strpos($text,'[h1]') !== false) { $text = preg_replace("(\[h1\](.*?)\[\/h1\])ism",'<h1>$1</h1>',$text); - $text = str_replace(["</h1>\n\n", "</h1>\n"], '</h1>', $text); + $text = str_replace(["</h1>\r", "</h1>\n"], '</h1>', $text); } // Check for h2 if (strpos($text,'[h2]') !== false) { $text = preg_replace("(\[h2\](.*?)\[\/h2\])ism",'<h2>$1</h2>',$text); - $text = str_replace(["</h2>\n\n", "</h2>\n"], '</h2>', $text); + $text = str_replace(["</h2>\r", "</h2>\n"], '</h2>', $text); } // Check for h3 if (strpos($text,'[h3]') !== false) { $text = preg_replace("(\[h3\](.*?)\[\/h3\])ism",'<h3>$1</h3>',$text); - $text = str_replace(["</h3>\n\n", "</h3>\n"], '</h3>', $text); + $text = str_replace(["</h3>\r", "</h3>\n"], '</h3>', $text); } // Check for h4 if (strpos($text,'[h4]') !== false) { $text = preg_replace("(\[h4\](.*?)\[\/h4\])ism",'<h4>$1</h4>',$text); - $text = str_replace(["</h4>\n\n", "</h4>\n"], '</h4>', $text); + $text = str_replace(["</h4>\r", "</h4>\n"], '</h4>', $text); } // Check for h5 if (strpos($text,'[h5]') !== false) { $text = preg_replace("(\[h5\](.*?)\[\/h5\])ism",'<h5>$1</h5>',$text); - $text = str_replace(["</h5>\n\n", "</h5>\n"], '</h5>', $text); + $text = str_replace(["</h5>\r", "</h5>\n"], '</h5>', $text); } // Check for h6 if (strpos($text,'[h6]') !== false) { $text = preg_replace("(\[h6\](.*?)\[\/h6\])ism",'<h6>$1</h6>',$text); - $text = str_replace(["</h6>\n\n", "</h6>\n"], '</h6>', $text); + $text = str_replace(["</h6>\r", "</h6>\n"], '</h6>', $text); } // Check for table of content without params @@ -1507,6 +1507,8 @@ function bbcode($text, $options = []) { ((strpos($text, "[/dl]") !== false) && (strpos($text, "[dl") !== false)) || ((strpos($text, "[/li]") !== false) && (strpos($text, "[li]") !== false))) && (++$endlessloop < 20)) { + $text = str_replace(["[/list]\r", "[/list]\n"], '[/list]', $text); + $text = preg_replace_callback("/\[list\](.*?)\[\/list\]/ism",'bb_fix_lf', $text); $text = preg_replace("/\[list\](.*?)\[\/list\]/ism", '<ul class="listbullet">$1</ul>', $text); @@ -1729,10 +1731,12 @@ function bbcode($text, $options = []) { } // oembed tag - $text = oembed_bbcode2html($text); + if (strpos($text,'[/embed]') !== false) { + $text = oembed_bbcode2html($text); - // Avoid triple linefeeds through oembed - $text = str_replace("<br style='clear:left'></span><br /><br />", "<br style='clear:left'></span><br />", $text); + // Avoid triple linefeeds through oembed + $text = str_replace("<br style='clear:left'></span><br /><br />", "<br style='clear:left'></span>", $text); + } // If we found an event earlier, strip out all the event code and replace with a reformatted version. // Replace the event-start section with the entire formatted event. The other bbcode is stripped. diff --git a/tests/unit/includes/BBCodeTest.php b/tests/unit/includes/BBCodeTest.php index 100d28fc4..fedd2df06 100644 --- a/tests/unit/includes/BBCodeTest.php +++ b/tests/unit/includes/BBCodeTest.php @@ -109,15 +109,15 @@ class BBCodeTest extends UnitTestCase { ], 'list with linebreaks \n' => [ "some text\n[list]\n[*] item1\n[*] item2\n[/list]\nsome more text", - 'some text<br /><ul class="listbullet"><li> item1<li> item2</ul><br />some more text' + 'some text<br /><ul class="listbullet"><li> item1<li> item2</ul>some more text' ], 'list with linebreaks \r' => [ "some text\r[list]\r[*] item1\r[*] item2\r[/list]\rsome more text", - 'some text<br /><ul class="listbullet"><li> item1<li> item2</ul><br />some more text' + 'some text<br /><ul class="listbullet"><li> item1<li> item2</ul>some more text' ], 'list with linebreaks \r\n' => [ "some text\r\n[list]\r\n[*] item1\r\n[*] item2\r\n[/list]\r\nsome more text", - 'some text<br /><ul class="listbullet"><li> item1<li> item2</ul><br />some more text' + 'some text<br /><ul class="listbullet"><li> item1<li> item2</ul>some more text' ] ]; } diff --git a/view/theme/redbasic/css/sample.scss b/view/theme/redbasic/css/sample.scss index 87005be90..410026aa2 100644 --- a/view/theme/redbasic/css/sample.scss +++ b/view/theme/redbasic/css/sample.scss @@ -1,3 +1,7 @@ +// To compiled custom site bootstrap from sass, +// run this script from the document root for an example: +// php vendor/bin/pscss view/theme/redbasic/css/sample.scss view/theme/redbasic/css/bootstrap-custom.css + // See https://getbootstrap.com/docs/5.3/customize/sass/ for more infos // required import |