Steve Bennett wrote:
Incidentally, is there a way to get the output of the preprocessor, for testing? Something like mediawiki.org/w/preprocess.php?Foo maybe?
Short answer is no.
There's Special:ExpandTemplates if you want something nice-looking, but it's a bit different to the preprocessor used for HTML mode. For testing during development I used a combination of eval.php and a short web-based script which I could change at will. Here it is in one of its forms:
<?php require( dirname(__FILE__) . '/includes/WebStart.php' );
$t = Title::newFromText( 'x' ); $o = new ParserOptions; $text = <<<EOT =={{xyz}}== EOT; header( 'Content-Type: text/xml' ); $dom = $wgParser->preprocessToDom( $text ); print $dom->saveXML();
At various times, I used preprocessToDom(), parse(), replaceVariables() and preSaveTransform() as parser entry points. srvus() is a purpose-made entry point for differential fuzz testing, present in both Parser and Parser_OldPP.
-- Tim Starling