X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fparse.php;h=f01d8f5a827836aa215707da46de2f30c2a268fa;hb=ef44b9075c0e2746ec2df0aaefa0ae9b9174d2fa;hp=cf2fe541f22f2042a5f3cea159df907ffa835f00;hpb=708f51c2c60b970549f463776faa38318fd11d21;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/parse.php b/maintenance/parse.php index cf2fe541f2..f01d8f5a82 100644 --- a/maintenance/parse.php +++ b/maintenance/parse.php @@ -1,4 +1,7 @@ addOption( 'tidy', 'Tidy the output' ); + $this->addOption( 'no-tidy', 'Don\'t tidy the output (deprecated)' ); $this->addArg( 'file', 'File containing wikitext (Default: stdin)', false ); } @@ -82,7 +85,7 @@ class CLIParser extends Maintenance { * @return string HTML Rendering */ public function render( $wikitext ) { - return $this->parse( $wikitext )->getText(); + return $this->parse( $wikitext )->getText( [ 'wrapperDivClass' => '' ] ); } /** @@ -103,9 +106,7 @@ class CLIParser extends Maintenance { } protected function initParser() { - global $wgParserConf; - $parserClass = $wgParserConf['class']; - $this->parser = new $parserClass(); + $this->parser = MediaWikiServices::getInstance()->getParserFactory()->create(); } /** @@ -128,9 +129,10 @@ class CLIParser extends Maintenance { * @return ParserOutput */ protected function parse( $wikitext ) { - $options = new ParserOptions; - if ( $this->getOption( 'tidy' ) ) { - $options->setTidy( true ); + $options = ParserOptions::newCanonical(); + $options->setOption( 'enableLimitReport', false ); + if ( $this->getOption( 'no-tidy' ) ) { + $options->setTidy( false ); } return $this->parser->parse( $wikitext,