Skip to content

Commit

Permalink
Add option no_check
Browse files Browse the repository at this point in the history
Also repeat all test in the no_check mode.

Change-Id: Ie1e4296ede8eb50033f1a329bb8a1a69e379eb1b
  • Loading branch information
physikerwelt authored and Marko Obrovac committed Feb 16, 2016
1 parent 73b07b5 commit 0837b04
Show file tree
Hide file tree
Showing 5 changed files with 278 additions and 8 deletions.
1 change: 1 addition & 0 deletions config.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ services:
speech: true #new feature
texvcinfo: true
speech_on: true
no_check: false
1 change: 1 addition & 0 deletions config.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ services:
texvcinfo: true
speech: true
speech_on: false
no_check: true
19 changes: 11 additions & 8 deletions routes/mathoid.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ function handleRequest(res, q, type, outFormat, features) {
var mml = (type !== "MathML") && /^mml|json|complete$/.test(outFormat);
var png = app.conf.png && /^png|json|complete$/.test(outFormat);
var img = app.conf.img && /^json|complete$/.test(outFormat);
var info = app.conf.texvcinfo && /^graph|texvcinfo$/.test(outFormat);
var speech = (outFormat !== "png") && features.speech || outFormat === "speech";
var chem = type === "chem";

if (chem) {
type = "inline-TeX";
}
if (type === "TeX" || type === "inline-TeX") {
if ((!app.conf.no_check && /^TeX|inline-TeX$/.test(type)) || info ) {
feedback = texvcInfo.feedback(q,{usemhchem: chem});
// XXX properly handle errors here!
if (feedback.success) {
Expand All @@ -71,13 +72,15 @@ function handleRequest(res, q, type, outFormat, features) {
} else {
emitError(feedback.error.name + ': ' + feedback.error.message, feedback);
}
if (app.conf.texvcinfo && outFormat === "graph") {
res.json(texvcInfo.texvcinfo(q, {"format": "json", "compact": true}));
return;
}
if (app.conf.texvcinfo && outFormat === "texvcinfo") {
res.json(feedback).end();
return;
if (info) {
if (outFormat === "graph") {
res.json(texvcInfo.texvcinfo(q, {"format": "json", "compact": true}));
return;
}
if (info && outFormat === "texvcinfo") {
res.json(feedback).end();
return;
}
}
}

Expand Down
Loading

0 comments on commit 0837b04

Please sign in to comment.