Physikerwelt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/334420 )

Change subject: WIP: Create cli
......................................................................

WIP: Create cli

Change-Id: I3dec4ba52d3783033d3621012177127c78cfe6f7
---
M routes/mathoid.js
1 file changed, 18 insertions(+), 13 deletions(-)


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

diff --git a/routes/mathoid.js b/routes/mathoid.js
index 433c9ce..0ebca36 100644
--- a/routes/mathoid.js
+++ b/routes/mathoid.js
@@ -175,19 +175,8 @@
 }
 
 
-/**
- * POST /
- * Performs the rendering request
- */
-router.post('/:outformat?/', function (req, res) {
-    var outFormat;
-    var speech = app.conf.speech_on;
-    // First some rudimentary input validation
-    if (!(req.body.q)) {
-        emitError("q (query) post parameter is missing!");
-    }
-    var q = req.body.q;
-    var type = (req.body.type || 'tex').toLowerCase();
+var getRequestType = function (type) {
+    type = (type|| 'tex').toLowerCase();
     switch (type) {
         case "tex":
             type = "TeX";
@@ -210,6 +199,22 @@
         default :
             emitError("Input format \"" + type + "\" is not recognized!");
     }
+    return type;
+};
+
+/**
+ * POST /
+ * Performs the rendering request
+ */
+router.post('/:outformat?/', function (req, res) {
+    var outFormat;
+    var speech = app.conf.speech_on;
+    // First some rudimentary input validation
+    if (!(req.body.q)) {
+        emitError("q (query) post parameter is missing!");
+    }
+    var q = req.body.q;
+    var type = getRequestType(req.body.type);
     if (req.body.nospeech) {
         speech = false;
     }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3dec4ba52d3783033d3621012177127c78cfe6f7
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