From 787a647026958483f4b5616141ecc1ca5a47b8e8 Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Thu, 20 Sep 2018 11:16:07 -0400 Subject: [PATCH] Make maintenance/parse.php default to tidy output We are deprecating the non-tidy modes of the parser. While we're at it, remove the output wrapper by default (in both tidy and no-tidy modes). Bug: T198214 Change-Id: Ieb51cb0f3a8a62e272d76c368f29fb63c030c522 --- RELEASE-NOTES-1.32 | 3 +++ maintenance/parse.php | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index 499bf58130..60f5e6abf1 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -320,6 +320,9 @@ because of Phabricator reports. Wikimedia\Rdbms\LBFactory. * The MimeMagic class, deprecated since 1.28 has been removed. Get a MimeAnalyzer instance from MediaWikiServices instead. +* The '--tidy' option to maintenance/parse.php has been removed. Tidying + the output is now the default. Use '--no-tidy' to bypass the tidy + phase. === Deprecations in 1.32 === * HTMLForm::setSubmitProgressive() is deprecated. No need to call it. Submit diff --git a/maintenance/parse.php b/maintenance/parse.php index d9a247c354..f01d8f5a82 100644 --- a/maintenance/parse.php +++ b/maintenance/parse.php @@ -71,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 ); } @@ -85,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' => '' ] ); } /** @@ -129,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, -- 2.20.1