1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Update Parsedown.php

Made parsedown compatible with html-tags containing dashes.
see https://github.com/erusev/parsedown/issues/407#issuecomment-248833563
This commit is contained in:
pablotheissen 2016-09-22 12:21:39 +02:00 committed by GitHub
parent a2ed1592bd
commit 1a44cbd62c

View File

@ -673,7 +673,7 @@ class Parsedown
return; return;
} }
if (preg_match('/^<(\w*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches)) if (preg_match('/^<(\w[\w-]*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches))
{ {
$element = strtolower($matches[1]); $element = strtolower($matches[1]);
@ -1258,7 +1258,7 @@ class Parsedown
return; return;
} }
if ($Excerpt['text'][1] === '/' and preg_match('/^<\/\w*[ ]*>/s', $Excerpt['text'], $matches)) if ($Excerpt['text'][1] === '/' and preg_match('/^<\/\w[\w-]*[ ]*>/s', $Excerpt['text'], $matches))
{ {
return array( return array(
'markup' => $matches[0], 'markup' => $matches[0],
@ -1274,7 +1274,7 @@ class Parsedown
); );
} }
if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $Excerpt['text'], $matches)) if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w[\w-]*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $Excerpt['text'], $matches))
{ {
return array( return array(
'markup' => $matches[0], 'markup' => $matches[0],