adf
v0.1.1
Published
A Document Format
Downloads
32
Readme
A Document Format
ADF is a simple structured file format, allowing you to create lists of items with properties.
Installation:
npm install adf
Usage:
var adfparse = require("adf");
var fileContent = // read a file
var ast = adfparse(fileContent);
Example:
Parsing this:
# meta = data
list header
item text {prop=2,"dsa", "dsa"}
another list
item text again {prop="more properties"}
more items here {properties="are currently mandatory for every item"}
Will yield this:
{ meta: { meta: 'data' },
items:
[ { header: 'list header',
titles:
[ { name: 'item text',
property: { type: 'prop', values: [ 2, 'dsa', 'dsa' ] } } ] },
{ header: 'another list',
titles:
[ { name: 'item text again',
property: { type: 'prop', values: [ 'more properties' ] } },
{ name: 'more items here',
property:
{ type: 'properties',
values: [ 'are currently mandatory for every item' ] } } ] } ] }
There are also examples in the test directory.