Skip to content

Commit

Permalink
Merge pull request #284 from mathjax/issue277
Browse files Browse the repository at this point in the history
Don't produce mml when mmlNode is requested if mml wasn't requested. #277
  • Loading branch information
pkra authored Jan 30, 2017
2 parents 1ff9d60 + cf60513 commit 5bb9b98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,12 +537,13 @@ function GetMML(result) {
}
}
try {
result.mml = jax.root.toMathML('',jax);
if (data.mmlNode) result.mmlNode = jsdom(result.mml).body.firstChild;
var mml = jax.root.toMathML('',jax);
} catch(err) {
if (!err.restart) {throw err;} // an actual error
return MathJax.Callback.After(window.Array(GetMML,result),err.restart);
}
if (data.mml) result.mml = mml;
if (data.mmlNode) result.mmlNode = jsdom(mml).body.firstChild;
}

//
Expand Down
4 changes: 2 additions & 2 deletions test/issue277.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var tape = require('tape');
var mjAPI = require("../lib/main.js");

tape('mmlNode should enable mml', function(t) {
tape('mmlNode should not produce mml', function(t) {
t.plan(1);
mjAPI.start();
var tex = 'x';
Expand All @@ -11,6 +11,6 @@ tape('mmlNode should enable mml', function(t) {
format: "TeX",
mmlNode: true
}, function(data) {
t.ok(data.mml, 'MathML generated');
t.ok(data.mml === undefined, 'mml not generated');
});
});

0 comments on commit 5bb9b98

Please sign in to comment.