X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fparse.php;h=f01d8f5a827836aa215707da46de2f30c2a268fa;hb=ef44b9075c0e2746ec2df0aaefa0ae9b9174d2fa;hp=b87a716f622d730e1bdcc00b655b8c93050fd5ed;hpb=e69bcfad17d67da5113cdd75276a5f7b5cefb123;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/parse.php b/maintenance/parse.php index b87a716f62..f01d8f5a82 100644 --- a/maintenance/parse.php +++ b/maintenance/parse.php @@ -1,4 +1,7 @@ - * @license GNU General Public License 2.0 or later + * @license GPL-2.0-or-later */ require_once __DIR__ . '/Maintenance.php'; @@ -68,7 +71,7 @@ class CLIParser extends Maintenance { false, true ); - $this->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,