Last active
May 27, 2016 07:43
-
-
Save pkra/d2894330e784f27dbc6e8b12763ca972 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var mjAPI = require("./lib/main"); | |
var fs = require('fs'); | |
var inputFile = "file.txt"; // use xargs or something | |
var output = []; | |
var array = fs.readFileSync('file.txt').toString().split("\n"); | |
mjAPI.start(); | |
for (var i = 0; i < array.length; i++) { | |
let index = i; | |
mjAPI.typeset({ | |
math: array[index], | |
format: "TeX", | |
mml: true | |
}, function(data) { | |
var e = data.errors; | |
if (e) { | |
output.push(e); | |
} | |
if ( (index+1) === array.length){ | |
console.log('Results: ' + output.join('\n')); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment