Use RestBase to check input tex rather than texvccheck
* This will increase the performance of tex rendering for all rendering modes since no shell access is required anymore. Merge with caution. If the connection to restbase fails, rendering of new formulae will be completely disabled i.e. broken. Change-Id: I1982612e8c6a356e3dbdf447724ac82e5968cc77
This commit is contained in:
parent
f63eaeac23
commit
897afa480b
@ -572,7 +572,7 @@ abstract class MathRenderer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$checker = new MathInputCheckTexvc( $this->userInputTex );
|
$checker = new MathInputCheckRestbase( $this->userInputTex );
|
||||||
if ( $checker->isValid() ) {
|
if ( $checker->isValid() ) {
|
||||||
$this->setTex( $checker->getValidTex() );
|
$this->setTex( $checker->getValidTex() );
|
||||||
$this->texSecure = true;
|
$this->texSecure = true;
|
||||||
|
@ -8,6 +8,25 @@ class MathRendererTest extends MediaWikiTestCase {
|
|||||||
const SOME_TEX = "a+b";
|
const SOME_TEX = "a+b";
|
||||||
const TEXVCCHECK_INPUT = '\forall \epsilon \exist \delta';
|
const TEXVCCHECK_INPUT = '\forall \epsilon \exist \delta';
|
||||||
const TEXVCCHECK_OUTPUT = '\forall \epsilon \exists \delta '; // be aware of the s at exists
|
const TEXVCCHECK_OUTPUT = '\forall \epsilon \exists \delta '; // be aware of the s at exists
|
||||||
|
|
||||||
|
protected static $hasRestbase;
|
||||||
|
|
||||||
|
public static function setUpBeforeClass() {
|
||||||
|
$rbi = new MathRestbaseInterface();
|
||||||
|
self::$hasRestbase = $rbi->checkBackend( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up the fixture, for example, opens a network connection.
|
||||||
|
* This method is called before a test is executed.
|
||||||
|
*/
|
||||||
|
protected function setUp() {
|
||||||
|
parent::setUp();
|
||||||
|
if ( !self::$hasRestbase ) {
|
||||||
|
$this->markTestSkipped( "Can not connect to Restbase Math interface." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the tex and hash functions
|
* Checks the tex and hash functions
|
||||||
* @covers MathRenderer::getTex()
|
* @covers MathRenderer::getTex()
|
||||||
|
Loading…
Reference in New Issue
Block a user