parser: Don't unnecessarily add and remove a pipe
authorArlo Breault <abreault@wikimedia.org>
Wed, 16 May 2018 15:29:10 +0000 (11:29 -0400)
committerLegoktm <legoktm@member.fsf.org>
Wed, 16 May 2018 16:39:48 +0000 (16:39 +0000)
Change-Id: I884ab88f9e8ac6f402cd4b3a54e33ccbd30637a2

includes/parser/Parser.php

index b66031c..ac20b6a 100644 (file)
@@ -5087,17 +5087,15 @@ class Parser {
                                                                } else {
                                                                        // Guess not, consider it as caption.
                                                                        wfDebug( "$parameterMatch failed parameter validation\n" );
-                                                                       $label = '|' . $parameterMatch;
+                                                                       $label = $parameterMatch;
                                                                }
                                                }
 
                                        } else {
                                                // Last pipe wins.
-                                               $label = '|' . $parameterMatch;
+                                               $label = $parameterMatch;
                                        }
                                }
-                               // Remove the pipe.
-                               $label = substr( $label, 1 );
                        }
 
                        $ig->add( $title, $label, $alt, $link, $handlerOptions );