Merge "Add --tidy option to maintenance/parse.php"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 14 Mar 2017 23:23:29 +0000 (23:23 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 14 Mar 2017 23:23:29 +0000 (23:23 +0000)
maintenance/parse.php

index 17a8d2e..6279a34 100644 (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
                );
        }
 }