jenkins-bot has submitted this change and it was merged.

Change subject: Cleanup in doTableStuff
......................................................................


Cleanup in doTableStuff

Change-Id: I75c0a943b24f96a30c6ee1efc3f0b11388f892b7
---
M includes/parser/Parser.php
1 file changed, 7 insertions(+), 6 deletions(-)

Approvals:
  Tim Starling: Looks good to me, approved
  Subramanya Sastry: Looks good to me, but someone else must approve
  Cscott: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 5506684..7f92590 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -1023,6 +1023,7 @@
                        }
 
                        $first_character = $line[0];
+                       $first_two = substr( $line, 0, 2 );
                        $matches = array();
 
                        if ( preg_match( '/^(:*)\{\|(.*)$/', $line, $matches ) 
) {
@@ -1042,7 +1043,7 @@
                                # Don't do any of the following
                                $out .= $outLine . "\n";
                                continue;
-                       } elseif ( substr( $line, 0, 2 ) === '|}' ) {
+                       } elseif ( $first_two === '|}' ) {
                                # We are ending a table
                                $line = '</table>' . substr( $line, 2 );
                                $last_tag = array_pop( $last_tag_history );
@@ -1060,7 +1061,7 @@
                                }
                                array_pop( $tr_attributes );
                                $outLine = $line . str_repeat( '</dd></dl>', 
$indent_level );
-                       } elseif ( substr( $line, 0, 2 ) === '|-' ) {
+                       } elseif ( $first_two === '|-' ) {
                                # Now we have a table row
                                $line = preg_replace( '#^\|-+#', '', $line );
 
@@ -1089,15 +1090,15 @@
                                array_push( $last_tag_history, '' );
                        } elseif ( $first_character === '|'
                                || $first_character === '!'
-                               || substr( $line, 0, 2 ) === '|+'
+                               || $first_two === '|+'
                        ) {
                                # This might be cell elements, td, th or 
captions
-                               if ( substr( $line, 0, 2 ) === '|+' ) {
+                               if ( $first_two === '|+' ) {
                                        $first_character = '+';
+                                       $line = substr( $line, 2 );
+                               } else {
                                        $line = substr( $line, 1 );
                                }
-
-                               $line = substr( $line, 1 );
 
                                if ( $first_character === '!' ) {
                                        $line = str_replace( '!!', '||', $line 
);

-- 
To view, visit https://gerrit.wikimedia.org/r/222683
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I75c0a943b24f96a30c6ee1efc3f0b11388f892b7
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: Jackmcbarn <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to