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

improve CommonMark compliance

This commit is contained in:
Emanuil Rusev 2015-01-16 01:24:02 +02:00
parent b4a8eb3315
commit 79d924040a

View File

@ -1212,12 +1212,20 @@ class Parsedown
protected function inlineTag($excerpt) protected function inlineTag($excerpt)
{ {
if ($this->markupEscaped) if ($this->markupEscaped or strpos($excerpt, '>') === false)
{ {
return; return;
} }
if (strpos($excerpt, '>') !== false and preg_match('/^<\/?\w.*?>/s', $excerpt, $matches)) if (preg_match('/^<\w*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $excerpt, $matches))
{
return array(
'markup' => $matches[0],
'extent' => strlen($matches[0]),
);
}
if ($excerpt[1] === '/' and preg_match('/^<\/\w*[ ]*>/s', $excerpt, $matches))
{ {
return array( return array(
'markup' => $matches[0], 'markup' => $matches[0],