From 66f5b34c0742341717b22653f707fcee7d31b318 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 20 Mar 2024 21:08:23 +0000 Subject: possible fix for issue #1843 --- include/bbcode.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index 86944ba60..360ebadc8 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -1729,10 +1729,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("


", "

", $text); + // Avoid triple linefeeds through oembed + $text = str_replace("


", "
", $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. -- cgit v1.2.3 From 49509e73473de6f3528c7fdba8a4fa5437829817 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 21 Mar 2024 09:47:34 +0000 Subject: more whitespace fixes and some docu --- include/bbcode.php | 14 ++++++++------ view/theme/redbasic/css/sample.scss | 4 ++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index 360ebadc8..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",'

$1

',$text); - $text = str_replace(["\n\n", "\n"], '', $text); + $text = str_replace(["\r", "\n"], '', $text); } // Check for h2 if (strpos($text,'[h2]') !== false) { $text = preg_replace("(\[h2\](.*?)\[\/h2\])ism",'

$1

',$text); - $text = str_replace(["\n\n", "\n"], '', $text); + $text = str_replace(["\r", "\n"], '', $text); } // Check for h3 if (strpos($text,'[h3]') !== false) { $text = preg_replace("(\[h3\](.*?)\[\/h3\])ism",'

$1

',$text); - $text = str_replace(["\n\n", "\n"], '', $text); + $text = str_replace(["\r", "\n"], '', $text); } // Check for h4 if (strpos($text,'[h4]') !== false) { $text = preg_replace("(\[h4\](.*?)\[\/h4\])ism",'

$1

',$text); - $text = str_replace(["\n\n", "\n"], '', $text); + $text = str_replace(["\r", "\n"], '', $text); } // Check for h5 if (strpos($text,'[h5]') !== false) { $text = preg_replace("(\[h5\](.*?)\[\/h5\])ism",'
$1
',$text); - $text = str_replace(["\n\n", "\n"], '', $text); + $text = str_replace(["\r", "\n"], '', $text); } // Check for h6 if (strpos($text,'[h6]') !== false) { $text = preg_replace("(\[h6\](.*?)\[\/h6\])ism",'
$1
',$text); - $text = str_replace(["\n\n", "\n"], '', $text); + $text = str_replace(["\r", "\n"], '', $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", '', $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 -- cgit v1.2.3 From 371b8440c3a57103bfdfe15373b025ee1f4a73d3 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 21 Mar 2024 11:04:03 +0000 Subject: adjust tests after recent commit --- tests/unit/includes/BBCodeTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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
  • item1
  • item2

some more text' + 'some text
  • item1
  • item2
some more text' ], 'list with linebreaks \r' => [ "some text\r[list]\r[*] item1\r[*] item2\r[/list]\rsome more text", - 'some text
  • item1
  • item2

some more text' + 'some text
  • item1
  • item2
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
  • item1
  • item2

some more text' + 'some text
  • item1
  • item2
some more text' ] ]; } -- cgit v1.2.3