The module is developed in node, but is intended to also run in Google Script and browsers. More developement
need to be done, but most of it would involved changes to
generateRows in generaterows.js.
Note that the parsing is synchronous, because
Declare terms, which reference other files, must be fully processed before
any following terms can be processed. There may be a way to make all IO asynchronous, but it would probably involve a significant change in structure.
Install the development version from Github.
$ npm install CivicKnowledge/metatab-js
To produce JSON of a metatab file, given a file system path or URL:
var ti = new Metatab.TermInterpreter(urlOrFilePath); var json = JSON.stringify(ti.run().toDict());
When the module is installed with
npm, it also creates an executable
metatab-js, which can parse files from the shell:
$ metatab-js https://raw.githubusercontent.com/CivicKnowledge/metatab-py/master/test-data/children.csv
metatab-js program is very simple. For a more complete, robust command line parser, install the python module and run the