From 3b4aa6bff7bde3ac72ec5e3d9e5a4a260bf1d693 Mon Sep 17 00:00:00 2001 From: Emanuil Rusev Date: Fri, 16 Jan 2015 01:46:43 +0200 Subject: [PATCH] change the parsing order of tag elements to improve performance --- Parsedown.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index eb1f88c..46d0715 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -1217,14 +1217,6 @@ class Parsedown 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)) { return array( @@ -1240,6 +1232,14 @@ class Parsedown '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)