This patch skip the [[Category:#]] parsing logic when the Title is in
NS_MEDIAWIKI and ends with .js or .css. This way the code is kept as is
and pages are no more categorized.
How to reproduce the issue:
$ echo 'var foo = "[[Category:bug32450]]"' \
| php maintenance/parse.php --title MediaWiki:Foobar.js
<p>var foo = ""
</p>
$
Note how the text got stripped.
After this patch:
$ echo 'var foo = "[[Category:bug32450]]"' \
| php maintenance/parse.php --title MediaWiki:Foobar.js
<p>var foo = "[[Category:bug32450]]"
</p>
$
TEST PLAN:
==========
$ php parserTests.php --quiet
This is MediaWiki version 1.19alpha (r103473).
Reading tests from "tests/parser/parserTests.txt"...
Reading tests from "tests/parser/extraParserTests.txt"...
Passed 654 of 654 tests (100%)... ALL TESTS PASSED!
$
* (bug 32168) Add wfAssembleUrl for use in wfExpandUrl
* (bug 32168) fixed - wfExpandUrl expands dot segments now
* (bug 31535) Upload comments now truncated properly, and don't have brackets
+* (bug 32450) Scripts pages in MediaWiki: namespace parse [[Category:#]] links
=== API changes in 1.19 ===
* (bug 19838) siprop=interwikimap can now use the interwiki cache.
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 ) {
!! end
+!! test
+Bug 32450: MediaWiki: js pages should ignore Category syntax
+!! options
+title=[[MediaWiki:bug32450.js]]
+!! input
+var foo = "[[Category:bug32450]]"
+!! result
+<p>var foo = "[[Category:bug32450]]"
+</p>
+!! end
+
+!! test
+Bug 32450: MediaWiki: css pages should ignore Category syntax
+!! options
+title=[[MediaWiki:bug32450.css]]
+!! input
+/** Css comment: "[[Category:bug32450]]" */
+!! result
+<p>/** Css comment: "[[Category:bug32450]]" */
+</p>
+!! end
+
TODO:
more images
more tables