Add chem option to texvc binary

Change-Id: Ie74c948de98480592c8e67e36b047393cd563346
This commit is contained in:
Moritz Schubotz (physikerwelt) 2023-11-14 20:02:57 +01:00
parent 1ff7740fa9
commit ed850f91fe
No known key found for this signature in database
GPG key ID: F803DB146DDF36C3

View file

@ -30,6 +30,7 @@ class TexVcCli extends Maintenance {
"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' );
}
@ -39,7 +40,8 @@ class TexVcCli extends Maintenance {
public function execute() {
$userInputTex = $this->getArg( 0 );
$texvc = new MediaWiki\Extension\Math\TexVC\TexVC();
$result = $texvc->check( $userInputTex );
$options = [ 'usemhchem' => $this->getOption( 'chem' ) ];
$result = $texvc->check( $userInputTex, $options );
if ( $result['status'] !== '+' ) {
$this->error( $result['status'] . $result['details'] );
}