Skip replaceInternalLinks2 for js/css pages
authorAntoine Musso <hashar@users.mediawiki.org>
Mon, 5 Dec 2011 10:14:40 +0000 (10:14 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Mon, 5 Dec 2011 10:14:40 +0000 (10:14 +0000)
Just skip the whole replaceInternalLinks2 parser function whenever we hit
js/css pages. Previous patch r103476 only handled Category links which was
not enough.

includes/parser/Parser.php

index 3c41eb3..881133b 100644 (file)
@@ -1643,6 +1643,12 @@ class Parser {
         * @private
         */
        function replaceInternalLinks( $s ) {
+               if( $this->getTitle()->isCssOrJsPage() ) {
+                       # bug 32450 : js and script pages in MediaWiki: namespace do not want
+                       # to get their code or comments altered. Think about js string:
+                       # var foobar = "[[Category:" + $catname + "]];
+                       return $s;
+               }
                $this->mLinkHolders->merge( $this->replaceInternalLinks2( $s ) );
                return $s;
        }
@@ -1913,14 +1919,6 @@ class Parser {
 
                                if ( $ns == NS_CATEGORY ) {
                                        wfProfileIn( __METHOD__."-category" );
-                                       if( $this->getTitle()->isCssOrJsPage() ) {
-                                               # bug 32450 : js and script pages in MediaWiki: namespace do not want
-                                               # to get their code or comments altered. Think about js string:
-                                               # var foobar = "[[Category:" + $catname + "]];
-                                               $s .= "[[$text]]$trail";
-                                               wfProfileOut( __METHOD__."-category" );
-                                               continue;
-                                       }
                                        $s = rtrim( $s . "\n" ); # bug 87
 
                                        if ( $wasblank ) {