Merge "Fix link prefix/suffixes around Category and Language links (take 2)."
[lhc/web/wiklou.git] / includes / parser / Parser.php
index 0d11d5a..d00b333 100644 (file)
@@ -3237,6 +3237,8 @@ class Parser {
                                        . wfMessage( 'parser-template-loop-warning', $titleText )->inContentLanguage()->text()
                                        . '</span>';
                                $this->addTrackingCategory( 'template-loop-category' );
+                               $this->mOutput->addWarning( wfMessage( 'template-loop-warning',
+                                       wfEscapeWikiText( $titleText ) )->text() );
                                wfDebug( __METHOD__ . ": template loop broken at '$titleText'\n" );
                        }
                }
@@ -4208,6 +4210,8 @@ class Parser {
                        # Save headline for section edit hint before it's escaped
                        $headlineHint = $safeHeadline;
 
+                       # Decode HTML entities
+                       $safeHeadline = Sanitizer::decodeCharReferences( $safeHeadline );
                        $fallbackHeadline = Sanitizer::escapeIdForAttribute( $safeHeadline, Sanitizer::ID_FALLBACK );
                        $linkAnchor = Sanitizer::escapeIdForLink( $safeHeadline );
                        $safeHeadline = Sanitizer::escapeIdForAttribute( $safeHeadline, Sanitizer::ID_PRIMARY );
@@ -5768,6 +5772,7 @@ class Parser {
                # Strip out wikitext links(they break the anchor)
                $text = $this->stripSectionName( $text );
                $text = Sanitizer::normalizeSectionNameWhitespace( $text );
+               $text = Sanitizer::decodeCharReferences( $text );
                return '#' . Sanitizer::escapeIdForLink( $text );
        }
 
@@ -5786,6 +5791,7 @@ class Parser {
                # Strip out wikitext links(they break the anchor)
                $text = $this->stripSectionName( $text );
                $text = Sanitizer::normalizeSectionNameWhitespace( $text );
+               $text = Sanitizer::decodeCharReferences( $text );
 
                if ( isset( $wgFragmentMode[1] ) && $wgFragmentMode[1] === 'legacy' ) {
                        // ForAttribute() and ForLink() are the same for legacy encoding