Rest service to Convert different math formats: Latex to MathMl and a subset of MathML to ASCIIMathML.
see etc/install-node-centos.txt
npm install express
npm install body-parser
npm install winston
npm install mathml-to-asciimath
npm install texzilla
npm install xmlhttprequest
npm install cors
nop install ascii2mathml
$ cd node_modules
$ tar xvf ../mathml-to-asciimath.tar
test the two conversion JS packages are correctly installed
% node
var convert = require('texzilla'); var lex ='x \leq y'; convert.toMathMLString(lex); var convert2 = require('mathml-to-asciimath'); var mathml = '1+2'; convert2(mathml); .exit
There will be various REST end points for this service:
/mathml_to_asciimath
/latex_to_asciimath
/latex_to_mathml
/asciimath_mathml
test Rest service from same directory, local connection:
$ node client-test-latex.js
$ node client-test-mathml.js
- test REST over network to make sure firewall is open; If not open, use 'ipTables' to check
From another machine,
Latex_toAsciiMath
%curl -H "Content-Type: application/json;charset=UTF-8" -X POST -d '{"id":90,"asciimath":"", "mathml":"", "latex":"x \lt y"}' http://192.168.1.156:8089/latex_to_asciimath
Asccimath to MathMl
%curl -H "Content-Type: application/json;charset=UTF-8" -X POST -d '{"id":90,"asciimath":"x < y", "mathml":"", "latex":""}' http://192.168.1.156:8089/asciimath_to_mathml
%curl -H "Content-Type: application/json;charset=UTF-8" -X POST -d '{"id":90,"asciimath":"sqrt((A+X)/2)/2", "mathml":"", "latex":""}' http://192.168.1.156:8089/asciimath_to_mathml
%echo '{"id":90,"asciimath":"", "mathml":"", "latex":"x \lt y"}' > post_loc.txt
%ab -p post_loc.txt -T application/json -c 5 -n 10 http://192.168.1.154:8083/latex_to_asciimath