Merge "Add support for PHP7 random_bytes in favor of mcrypt_create_iv"
[lhc/web/wiklou.git] / maintenance / parse.php
index effed56..6279a34 100644 (file)
@@ -68,12 +68,13 @@ class CLIParser extends Maintenance {
                        false,
                        true
                );
+               $this->addOption( 'tidy', 'Tidy the output' );
                $this->addArg( 'file', 'File containing wikitext (Default: stdin)', false );
        }
 
        public function execute() {
                $this->initParser();
-               print $this->render( $this->WikiText() );
+               print $this->render( $this->Wikitext() );
        }
 
        /**
@@ -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
                );
        }
 }