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

change the parsing order of tag elements to improve performance

This commit is contained in:
Emanuil Rusev 2015-01-16 01:46:43 +02:00
parent 05a8f16e95
commit 3b4aa6bff7

View File

@ -1217,14 +1217,6 @@ class Parsedown
return; return;
} }
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)) if ($excerpt[1] === '/' and preg_match('/^<\/\w*[ ]*>/s', $excerpt, $matches))
{ {
return array( return array(
@ -1240,6 +1232,14 @@ class Parsedown
'extent' => strlen($matches[0]), 'extent' => strlen($matches[0]),
); );
} }
if (preg_match('/^<\w*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $excerpt, $matches))
{
return array(
'markup' => $matches[0],
'extent' => strlen($matches[0]),
);
}
} }
protected function inlineCode($excerpt) protected function inlineCode($excerpt)