[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wikitech-l
Subject:    Re: [Wikitech-l] New preprocessor
From:       Tim Starling <tstarling () wikimedia ! org>
Date:       2007-11-27 2:28:46
Message-ID: fifvd3$ols$1 () ger ! gmane ! org
[Download RAW message or body]

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


_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
http://lists.wikimedia.org/mailman/listinfo/wikitech-l
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic