From a973482ef2eb04d2adbbbc65af39fb5bbccbe66e Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Sat, 14 Mar 2015 09:02:20 +0100 Subject: [PATCH] Fix bug in fix of breaking change Without this fix, the type passed to ArrayNode.toTex would stay there forever until you change it back manually instead of being used only once. --- lib/expression/node/Node.js | 5 +++++ lib/util/latex.js | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/expression/node/Node.js b/lib/expression/node/Node.js index 9f1d5d4f6..5f596fac2 100644 --- a/lib/expression/node/Node.js +++ b/lib/expression/node/Node.js @@ -232,6 +232,11 @@ Node.prototype.toString = function() { */ Node.prototype.toTex = function(customFunctions) { var customTex; + if (this.type === 'ArrayNode') { + //FIXME this is only a workaround for a breaking change, + //remove this in version2 + delete this.latexType; + } if (typeof customFunctions === 'object') { //if customFunctions is a map of callback functions if (customFunctions.hasOwnProperty(this.type)) { diff --git a/lib/util/latex.js b/lib/util/latex.js index a16683370..ed6afd33d 100644 --- a/lib/util/latex.js +++ b/lib/util/latex.js @@ -468,7 +468,9 @@ exports.toArgs = function(that, customFunctions) { if (that.args[0] instanceof ArrayNode) { //FIXME passing 'vmatrix' like that is really ugly that.args[0].latexType = 'vmatrix'; - return that.args[0].toTex(customFunctions); + var latex = that.args[0].toTex(customFunctions); + delete that.args[0].latexType; + return latex; } brace = 'vmatrix';