Make maintenance/parse.php default to tidy output
authorC. Scott Ananian <cscott@cscott.net>
Thu, 20 Sep 2018 15:16:07 +0000 (11:16 -0400)
committerC. Scott Ananian <cscott@cscott.net>
Tue, 25 Sep 2018 17:31:36 +0000 (13:31 -0400)
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
maintenance/parse.php

index 499bf58..60f5e6a 100644 (file)
@@ -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
index d9a247c..f01d8f5 100644 (file)
@@ -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,