Physikerwelt has uploaded a new change for review.
https://gerrit.wikimedia.org/r/267611
Change subject: Use mathoid 'fast' endpoint
......................................................................
Use mathoid 'fast' endpoint
Change-Id: Idce3ad7eabe864113f1168cad974204d463accf7
---
M MathMathML.php
M MathRestbaseInterface.php
2 files changed, 20 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math
refs/changes/11/267611/1
diff --git a/MathMathML.php b/MathMathML.php
index 515925e..492354f 100644
--- a/MathMathML.php
+++ b/MathMathML.php
@@ -21,6 +21,7 @@
/** @var boolean if false MathML output is not validated */
private $XMLValidation = true;
private $svgPath = false;
+ private $mathoidStyle;
public function __construct( $tex = '', $params = array() ) {
global $wgMathMathMLUrl;
@@ -84,7 +85,8 @@
}
if ( $rbi->getSuccess() ) {
$this->mathml = $rbi->getMathML();
- $this->svg = $rbi->getSvg();
+ //$this->svg = $rbi->getSvg();
+ $this->mathoidStyle = $rbi->getMathoidStyle();
$this->svgPath = $rbi->getFullSvgUrl();
}
$this->changed = false;
@@ -379,8 +381,9 @@
// TODO: move the common styles to the global stylesheet!
$style = 'background-image: url(\''. $url .
- '\'); background-repeat: no-repeat;
background-size: 100% 100%;';
- $this->correctSvgStyle( $this->getSvg(), $style );
+ '\'); background-repeat: no-repeat; background-size:
100% 100%; '.
+ $this->mathoidStyle;
+ // $this->correctSvgStyle( $this->getSvg(), $style );
if ( $class ) {
$attribs['class'] = $class;
}
diff --git a/MathRestbaseInterface.php b/MathRestbaseInterface.php
index 2e24e22..9384148 100644
--- a/MathRestbaseInterface.php
+++ b/MathRestbaseInterface.php
@@ -16,6 +16,8 @@
private $success;
private $identifiers;
private $error;
+ private $mathoidStyle;
+ private $mml;
/**
* MathRestbaseInterface constructor.
@@ -32,6 +34,9 @@
* @throws MWException
*/
public function getMathML() {
+ if ( $this->mml ){
+ return $this->mml;
+ }
return $this->getContent( 'mml' );
}
@@ -74,6 +79,8 @@
$this->success = $json->success;
$this->checkedTex = $json->checked;
$this->identifiers = $json->identifiers;
+ $this->mml = $json->mml;
+ $this->mathoidStyle = $json->mathoidStyle;
return true;
} else {
if ( isset( $json->detail ) && isset(
$json->detail->success ) ) {
@@ -103,7 +110,7 @@
'body' => $post
);
$serviceClient = $this->getServiceClient();
- $request['url'] = $this->getUrl(
"media/math/check/{$this->type}" );
+ $request['url'] = $this->getUrl(
"media/math/fast/{$this->type}" );
$response = $serviceClient->run( $request );
if ( $response['code'] === 200 ) {
$res = $response['body'];
@@ -293,4 +300,10 @@
$this->error = (object)array( 'error' => (object)array(
'message' => $msg ) );
}
+ /**
+ * @return mixed
+ */
+ public function getMathoidStyle() {
+ return $this->mathoidStyle;
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/267611
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idce3ad7eabe864113f1168cad974204d463accf7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits