opening code fence doesn't need 2 regex groups

This commit is contained in:
Emanuil Rusev 2015-07-16 16:56:56 +03:00
parent 28774a4359
commit a9dfc97ddc
1 changed files with 3 additions and 3 deletions

View File

@ -386,16 +386,16 @@ class Parsedown
protected function blockFencedCode($Line) protected function blockFencedCode($Line)
{ {
if (preg_match('/^(['.$Line['text'][0].']{3,})[ ]*([\w-]+)?[ ]*$/', $Line['text'], $matches)) if (preg_match('/^['.$Line['text'][0].']{3,}[ ]*([\w-]+)?[ ]*$/', $Line['text'], $matches))
{ {
$Element = array( $Element = array(
'name' => 'code', 'name' => 'code',
'text' => '', 'text' => '',
); );
if (isset($matches[2])) if (isset($matches[1]))
{ {
$class = 'language-'.$matches[2]; $class = 'language-'.$matches[1];
$Element['attributes'] = array( $Element['attributes'] = array(
'class' => $class, 'class' => $class,