parser: Rename $lastSection to $lastParagraph
authorArlo Breault <abreault@wikimedia.org>
Fri, 15 Mar 2019 19:41:22 +0000 (15:41 -0400)
committerArlo Breault <abreault@wikimedia.org>
Fri, 15 Mar 2019 19:45:59 +0000 (15:45 -0400)
This now at least matches the function names even though what's actually
meant is more like 'block-level tag'.  Section is a poor choice of name
since there're wikitext sections unrelated to this.

Change-Id: Ic83aff4d862800b778441c28884194480b7e7d96

includes/parser/BlockLevelPass.php

index 25f4b5c..b2bcc8c 100644 (file)
@@ -25,7 +25,7 @@
 class BlockLevelPass {
        private $DTopen = false;
        private $inPre = false;
-       private $lastSection = '';
+       private $lastParagraph = '';
        private $lineStart;
        private $text;
 
@@ -65,7 +65,7 @@ class BlockLevelPass {
         * @return bool
         */
        private function hasOpenParagraph() {
-               return $this->lastSection !== '';
+               return $this->lastParagraph !== '';
        }
 
        /**
@@ -77,13 +77,13 @@ class BlockLevelPass {
        private function closeParagraph( $atTheEnd = false ) {
                $result = '';
                if ( $this->hasOpenParagraph() ) {
-                       $result = '</' . $this->lastSection . '>';
+                       $result = '</' . $this->lastParagraph . '>';
                        if ( !$atTheEnd ) {
                                $result .= "\n";
                        }
                }
                $this->inPre = false;
-               $this->lastSection = '';
+               $this->lastParagraph = '';
                return $result;
        }
 
@@ -353,14 +353,14 @@ class BlockLevelPass {
                                        $inBlockElem = !$closeMatch;
                                } elseif ( !$inBlockElem && !$this->inPre ) {
                                        if ( substr( $t, 0, 1 ) == ' '
-                                               && ( $this->lastSection === 'pre' || trim( $t ) != '' )
+                                               && ( $this->lastParagraph === 'pre' || trim( $t ) != '' )
                                                && !$inBlockquote
                                        ) {
                                                # pre
-                                               if ( $this->lastSection !== 'pre' ) {
+                                               if ( $this->lastParagraph !== 'pre' ) {
                                                        $pendingPTag = false;
                                                        $output .= $this->closeParagraph() . '<pre>';
-                                                       $this->lastSection = 'pre';
+                                                       $this->lastParagraph = 'pre';
                                                }
                                                $t = substr( $t, 1 );
                                        } elseif ( preg_match( '/^(?:<style\\b[^>]*>.*?<\\/style>\s*|<link\\b[^>]*>\s*)+$/iS', $t ) ) {
@@ -376,9 +376,9 @@ class BlockLevelPass {
                                                        if ( $pendingPTag ) {
                                                                $output .= $pendingPTag . '<br />';
                                                                $pendingPTag = false;
-                                                               $this->lastSection = 'p';
+                                                               $this->lastParagraph = 'p';
                                                        } else {
-                                                               if ( $this->lastSection !== 'p' ) {
+                                                               if ( $this->lastParagraph !== 'p' ) {
                                                                        $output .= $this->closeParagraph();
                                                                        $pendingPTag = '<p>';
                                                                } else {
@@ -389,10 +389,10 @@ class BlockLevelPass {
                                                        if ( $pendingPTag ) {
                                                                $output .= $pendingPTag;
                                                                $pendingPTag = false;
-                                                               $this->lastSection = 'p';
-                                                       } elseif ( $this->lastSection !== 'p' ) {
+                                                               $this->lastParagraph = 'p';
+                                                       } elseif ( $this->lastParagraph !== 'p' ) {
                                                                $output .= $this->closeParagraph() . '<p>';
-                                                               $this->lastSection = 'p';
+                                                               $this->lastParagraph = 'p';
                                                        }
                                                }
                                        }