Linker: Use Parser::guessSectionNameFromStrippedText()
authorRoan Kattouw <roan.kattouw@gmail.com>
Wed, 22 Nov 2017 23:11:50 +0000 (18:11 -0500)
committerRoan Kattouw <roan.kattouw@gmail.com>
Thu, 7 Dec 2017 18:23:10 +0000 (10:23 -0800)
Instead of weird partial stuff.

Change-Id: Ibe7435a4723d2741e32d37d2ba67396d78d14044

includes/Linker.php

index 403b10a..17bcc91 100644 (file)
@@ -1170,12 +1170,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' );