Merge "Linker: Use Parser::guessSectionNameFromStrippedText()"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 12 Dec 2017 13:13:07 +0000 (13:13 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 12 Dec 2017 13:13:07 +0000 (13:13 +0000)
includes/Linker.php

index a0332cf..48be3bf 100644 (file)
@@ -1192,12 +1192,12 @@ class Linker {
                                                $section = str_replace( '[[', '', $section );
                                                $section = str_replace( ']]', '', $section );
 
-                                               $section = Sanitizer::normalizeSectionNameWhitespace( $section ); # T24784
+                                               $section = substr( Parser::guessSectionNameFromStrippedText( $section ), 1 );
                                                if ( $local ) {
-                                                       $sectionTitle = Title::newFromText( '#' . $section );
+                                                       $sectionTitle = Title::makeTitleSafe( NS_MAIN, '', $section );
                                                } else {
                                                        $sectionTitle = Title::makeTitleSafe( $title->getNamespace(),
-                                                               $title->getDBkey(), Sanitizer::decodeCharReferences( $section ) );
+                                                               $title->getDBkey(), $section );
                                                }
                                                if ( $sectionTitle ) {
                                                        $link = Linker::makeCommentLink( $sectionTitle, $wgLang->getArrow(), $wikiId, 'noclasses' );