Physikerwelt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/227457

Change subject: Fix inline-tex input format
......................................................................

Fix inline-tex input format

* inline-tex input format was broken in previous commit
* handle input format (type) and output format in the
  same way
* throw an error if an unrecognized input format is used

Change-Id: I2e6758efb9d722d03caf8a6b361d3d04320a21a3
---
M routes/mathoid.js
1 file changed, 21 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/mathoid 
refs/changes/57/227457/1

diff --git a/routes/mathoid.js b/routes/mathoid.js
index d14ab47..6c61bc2 100644
--- a/routes/mathoid.js
+++ b/routes/mathoid.js
@@ -39,8 +39,7 @@
     var png = false;
     var img = false;
     //Keep format variables constant
-    if (type === "tex") {
-        type = "TeX";
+    if (type === "TeX" || type === "inline-TeX" ) {
         var sanitizationOutput = texvcjs.check(q);
         // XXX properly handle errors here!
         if (sanitizationOutput.status === '+') {
@@ -54,12 +53,8 @@
     png = app.conf.png && (outFormat === "png" || outFormat === "json");
     svg = app.conf.svg && (outFormat === "svg" || outFormat === "json");
     img = app.conf.img && outFormat === "json";
-    if (type === "mml" || type === "MathML") {
-        type = "MathML";
+    if ( type === "MathML") {
         mml = false; // use the original MathML
-    }
-    if (type === "ascii" || type === "asciimath") {
-        type = "AsciiMath";
     }
     if (speakText && outFormat === "png") {
         speakText = false;
@@ -127,6 +122,25 @@
     }
     var q = req.body.q;
     var type = (req.body.type || 'tex').toLowerCase();
+    switch ( type ) {
+        case "tex":
+            type = "TeX";
+            break;
+        case "inline-tex":
+            type = "inline-TeX";
+            break;
+        case "mml":
+        case "mathml":
+            type = "MathML";
+            break;
+        case "ascii":
+        case "asciimathml":
+        case "asciimath":
+            type = "AsciiMath";
+            break;
+        default :
+            emitError("Input format \""+type+"\" is not recognized!");
+    }
     if (req.body.noSpeak){
         speakText = false;
     }

-- 
To view, visit https://gerrit.wikimedia.org/r/227457
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2e6758efb9d722d03caf8a6b361d3d04320a21a3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mathoid
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <w...@physikerwelt.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to