+ private static function getSectionNameFromStrippedText( $text ) {
+ $text = Sanitizer::normalizeSectionNameWhitespace( $text );
+ $text = Sanitizer::decodeCharReferences( $text );
+ $text = self::normalizeSectionName( $text );
+ return $text;
+ }
+
+ private static function makeAnchor( $sectionName ) {
+ return '#' . Sanitizer::escapeIdForLink( $sectionName );
+ }
+
+ private static function makeLegacyAnchor( $sectionName ) {
+ global $wgFragmentMode;
+ if ( isset( $wgFragmentMode[1] ) && $wgFragmentMode[1] === 'legacy' ) {
+ // ForAttribute() and ForLink() are the same for legacy encoding
+ $id = Sanitizer::escapeIdForAttribute( $text, Sanitizer::ID_FALLBACK );
+ } else {
+ $id = Sanitizer::escapeIdForLink( $text );
+ }
+
+ return "#$id";
+ }
+