From eab3cbf25552f21aa58fd35ecd6a20eb7b509a56 Mon Sep 17 00:00:00 2001 From: Emanuil Rusev Date: Mon, 28 Apr 2014 02:10:18 +0300 Subject: [PATCH] remove unnecessary nesting --- Parsedown.php | 58 ++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index 0c00f27..e5cd468 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -916,36 +916,38 @@ class Parsedown $Span = $this->$handler($markedExcerpt, $text); - if (isset($Span)) + if ( ! isset($Span)) { - # The identified span can be ahead of the marker. - - if (isset($Span['position']) and $Span['position'] > $markerPosition) - { - continue; - } - - # Spans that start at the position of their marker don't have to set a position. - - if ( ! isset($Span['position'])) - { - $Span['position'] = $markerPosition; - } - - $unmarkedText = substr($text, 0, $Span['position']); - - $markup .= $this->readPlainText($unmarkedText); - - $markup .= isset($Span['element']) ? $this->element($Span['element']) : $Span['markup']; - - $text = substr($text, $Span['position'] + $Span['extent']); - - $remainder = $text; - - $markerPosition = 0; - - continue 2; + continue; } + + # The identified span can be ahead of the marker. + + if (isset($Span['position']) and $Span['position'] > $markerPosition) + { + continue; + } + + # Spans that start at the position of their marker don't have to set a position. + + if ( ! isset($Span['position'])) + { + $Span['position'] = $markerPosition; + } + + $unmarkedText = substr($text, 0, $Span['position']); + + $markup .= $this->readPlainText($unmarkedText); + + $markup .= isset($Span['element']) ? $this->element($Span['element']) : $Span['markup']; + + $text = substr($text, $Span['position'] + $Span['extent']); + + $remainder = $text; + + $markerPosition = 0; + + continue 2; } $remainder = substr($markedExcerpt, 1);