From: Antoine Musso Date: Mon, 5 Dec 2011 10:14:40 +0000 (+0000) Subject: Skip replaceInternalLinks2 for js/css pages X-Git-Tag: 1.31.0-rc.0~26178 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=7fc6a7aae05f9d501df3b1ad06e7d151434adab0;p=lhc%2Fweb%2Fwiklou.git Skip replaceInternalLinks2 for js/css pages Just skip the whole replaceInternalLinks2 parser function whenever we hit js/css pages. Previous patch r103476 only handled Category links which was not enough. --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 3c41eb3d4a..881133b721 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -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 ) {