diff --git a/ext/bbcode/main.php b/ext/bbcode/main.php index 5d39b6f4..8746a050 100644 --- a/ext/bbcode/main.php +++ b/ext/bbcode/main.php @@ -7,6 +7,12 @@ namespace Shimmie2; class BBCode extends FormatterExtension { public function format(string $text): string + { + $text = $this->_format($text); + return "$text"; + } + + public function _format(string $text): string { $text = $this->extract_code($text); foreach ([ @@ -158,7 +164,7 @@ class BBCode extends FormatterExtension $middle = base64_decode(substr($text, $start + $l1, ($end - $start - $l1))); $ending = substr($text, $end + $l2, (strlen($text) - $end + $l2)); - $text = $beginning . "
" . $middle . "
" . $ending; + $text = $beginning . "
" . $middle . "
" . $ending; } return $text; } diff --git a/ext/bbcode/style.css b/ext/bbcode/style.css index 32c257a1..525ff5c5 100644 --- a/ext/bbcode/style.css +++ b/ext/bbcode/style.css @@ -1,16 +1,15 @@ - -CODE { - background: #DEDEDE; - font-size: 0.8rem; +.bbcode PRE.code { + background: #DEDEDE; + font-size: 0.9rem; } -BLOCKQUOTE { +.bbcode BLOCKQUOTE { border: 1px solid black; padding: 8px; background: #DDD; } -.anchor A.alink { +.bbcode .anchor A.alink { visibility: hidden; } -.anchor:hover A.alink { +.bbcode .anchor:hover A.alink { visibility: visible; } diff --git a/ext/bbcode/test.php b/ext/bbcode/test.php index 359ee3e0..20b42b6a 100644 --- a/ext/bbcode/test.php +++ b/ext/bbcode/test.php @@ -37,7 +37,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase public function testCode() { $this->assertEquals( - "
[b]bold[/b]
", + "
[b]bold[/b]
", $this->filter("[code][b]bold[/b][/code]") ); } @@ -104,7 +104,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase private function filter($in): string { $bb = new BBCode(); - return $bb->format($in); + return $bb->_format($in); } private function strip($in): string