fred-wang / TeXZilla

LALR Javascript LaTeX-to-MathML converter compatible with Unicode
http://fred-wang.github.io/TeXZilla/
130 stars 21 forks source link

Enhancements to the commonJS command line API #7

Closed fred-wang closed 10 years ago

fred-wang commented 10 years ago

Currently, the commonJS API only exposes the getTeXSource, toMathMLString and toMathML functions. When commonJS is more standardized it would be useful to extend the API. Concrete use cases:

http://wiki.commonjs.org/wiki/System/1.0 http://wiki.commonjs.org/wiki/JSGI

fred-wang commented 10 years ago

I've added a basic command line interface.

slimerjs TeXZilla.js parser aTeX [aDisplay] [aRTL] [aThrowExceptionOnError]
  Print TeXZilla.toMathMLString(aTeX, aDisplay, aRTL, aThrowExceptionOnError)
  The interpretation of arguments and the default values are the same.

slimerjs TeXZilla.js webserver [port]
  TODO

cat input | slimerjs TeXZilla.js stream > output
  TODO
fred-wang commented 10 years ago

The interface is now:

  commonjs TeXZilla.js [help]
    Print this help message.

  commonjs TeXZilla.js parser aTeX [aDisplay] [aRTL] [aThrowExceptionOnError]
    Print TeXZilla.toMathMLString(aTeX, aDisplay, aRTL, aThrowExceptionOnError)
    The interpretation of arguments and the default values are the same.

  commonjs TeXZilla.js webserver [port]
    Start a Web server on the specified port (default:3141)
    See the TeXZilla wiki for details.

  cat input | commonjs TeXZilla.js streamfilter > output
    Make TeXZilla behaves as a stream filter. The TeX fragments are
    converted into MathML.

    where commonjs is slimerjs, nodejs or phantomjs.

However, I didn't find how to access the stdin with slimerJS so the streamfilter mode does not work (this has been reported to https://github.com/laurentj/slimerjs/issues/188).

fred-wang commented 10 years ago

The command line is now implemented. I'm moving the issue with slimerjs to #35