Skip to content

Commit c1ae815

Browse files
- fixed bug where code block is not parsed when language is left empty
- fixed bug where quote block is not parsed when quotee name contains whitespace character
1 parent 5a7429c commit c1ae815

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

BBCodePlus/BBCodePlus.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,12 @@ function add_tags() {
273273
$this->t_bbCode->addParser('table-body', '/\[tbody\](.*?)\[\/tbody\]/s', '<tbody>$1</tbody>', '$1');
274274
$this->t_bbCode->addParser('table-head-data', '/\[th\](.*?)\[\/th\]/s', '<th>$1</th>', '$1');
275275
$this->t_bbCode->addParser('code', '/\[code\](.*?)\[\/code\]/s', '<pre class="bbcodeplus pre"><code class="bbcodeplus code language-none">$1</code></pre>', '$1');
276-
$this->t_bbCode->addParser('code-lang', '/\[code=(\w+)\](.*?)\[\/code\]/s', '<pre class="bbcodeplus pre"><code class="bbcodeplus code language-$1">$2</code></pre>','$2');
276+
$this->t_bbCode->addParser('code-lang', '/\[code=(\w*)\](.*?)\[\/code\]/s', '<pre class="bbcodeplus pre"><code class="bbcodeplus code language-$1">$2</code></pre>','$2');
277277
$this->t_bbCode->addParser('code-ln', '/\[code start=([0-9]+)\](.*?)\[\/code\]/s', '<pre class="bbcodeplus pre line-numbers" data-start="$1"><code class="language-none">$2</code></pre>', '$3');
278-
$this->t_bbCode->addParser('code-lang-ln', '/\[code=(\w+)\ start=([0-9]+)\](.*?)\[\/code\]/s',
278+
$this->t_bbCode->addParser('code-lang-ln', '/\[code=(\w*)\ start=([0-9]+)\](.*?)\[\/code\]/s',
279279
'<pre class="bbcodeplus pre line-numbers" data-start="$2"><code class="bbcodeplus code language-$1">$3</code></pre>', '$3');
280280
$this->t_bbCode->addParser('quote', '/\[quote\](.*?)\[\/quote\]/s', '<blockquote class="bbcodeplus blockquote">$1</blockquote>', '$1');
281-
$this->t_bbCode->addParser('named-quote', '/\[quote=(\w+)\](.*?)\[\/quote\]/s',
281+
$this->t_bbCode->addParser('named-quote', '/\[quote=([\s\w]*)\](.*?)\[\/quote\]/s',
282282
'<blockquote class="bbcodeplus blockquote"><p class="mb-0">$2</p><footer class="bbcodeblus blockquote-footer"><cite title="$1">$1</cite></footer></blockquote>',
283283
'$1 wrote: $2');
284284
}

0 commit comments

Comments
 (0)