Add --tidy option to maintenance/parse.php

Change-Id: I6ec08237bd15ee2d824164a0493b7fff9ef312db
This commit is contained in:
Subramanya Sastry 2017-03-12 17:13:51 -05:00 committed by Tim Starling
parent dc35b44b20
commit ab68d05cc4

View file

@ -68,6 +68,7 @@ class CLIParser extends Maintenance {
false,
true
);
$this->addOption( 'tidy', 'Tidy the output' );
$this->addArg( 'file', 'File containing wikitext (Default: stdin)', false );
}
@ -127,10 +128,14 @@ class CLIParser extends Maintenance {
* @return ParserOutput
*/
protected function parse( $wikitext ) {
$options = new ParserOptions;
if ( $this->getOption( 'tidy' ) ) {
$options->setTidy( true );
}
return $this->parser->parse(
$wikitext,
$this->getTitle(),
new ParserOptions()
$options
);
}
}