#!/usr/bin/env php addDescription( "This script checks if the input is valid texvc." . "For valid input, it returns a normalized texvc string, " . "otherwise the error code and detail are shown." ); $this->addArg( 'input', 'The tex input to be checked', true ); $this->addOption( 'chem', 'Set for chem input', false, false ); $this->requireExtension( 'Math' ); } /** * @throws Exception */ public function execute() { $userInputTex = $this->getArg( 0 ); $texvc = new MediaWiki\Extension\Math\WikiTexVC\TexVC(); $options = [ 'usemhchem' => $this->getOption( 'chem' ) ]; $result = $texvc->check( $userInputTex, $options ); if ( $result['status'] !== '+' ) { $this->error( $result['status'] . $result['details'] ); } $this->output( $result['output'] ); $this->output( "\n" ); } } $maintClass = WikiTexVcCli::class; /** @noinspection PhpIncludeInspection */ require_once RUN_MAINTENANCE_IF_MAIN;