ApiFeedWatchlist: Use guessSectionNameFromWikiText()
authorRoan Kattouw <roan.kattouw@gmail.com>
Wed, 22 Nov 2017 23:03:14 +0000 (18:03 -0500)
committerRoan Kattouw <roan.kattouw@gmail.com>
Thu, 7 Dec 2017 18:20:24 +0000 (10:20 -0800)
Instead of reimplementing almost all of it by scraping it together from
various sources.

Change-Id: I22f0020e65e4c6c09edf030ae35fdee5bdaaf7bc

includes/api/ApiFeedWatchlist.php

index e3a757f..db15032 100644 (file)
@@ -215,10 +215,7 @@ class ApiFeedWatchlist extends ApiBase {
                        preg_match( '!(.*)/\*\s*(.*?)\s*\*/(.*)!', $comment, $matches )
                ) {
                        global $wgParser;
-
-                       $sectionTitle = $wgParser->stripSectionName( $matches[2] );
-                       $sectionTitle = Sanitizer::normalizeSectionNameWhitespace( $sectionTitle );
-                       $titleUrl .= Title::newFromText( '#' . $sectionTitle )->getFragmentForURL();
+                       $titleUrl .= $wgParser->guessSectionNameFromWikiText( $matches[ 2 ] );
                }
 
                $timestamp = $info['timestamp'];