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.
This commit is contained in:
Max Bruckner 2015-03-14 09:02:20 +01:00
parent 9a89ab27da
commit a973482ef2
2 changed files with 8 additions and 1 deletions

View File

@ -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)) {

View File

@ -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';