summaryrefslogtreecommitdiffstats
path: root/test.js
blob: 0de26b7884fefcf109b5c640782340df506efe77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var path = require('path');

var gitbook = require('./lib');
var Output = require('./lib/output');
var NodeFS = require('./lib/fs/node');


var BASE_PATH = path.join(__dirname); //, 'docs');

// Create a filesystem to read the book
var fs = NodeFS(BASE_PATH);

// Create a book instance
var book = gitbook.Book.createForFS(fs);

// Parse the book
gitbook.Parse.parseBook(book)
.then(function(_book) {
    return Output.generate(Output.JSONGenerator, _book, {
        root: path.join(__dirname, '_book')
    });
})
.then(function(pages) {
    //console.log('parsed', pages);
}, function(err) {
    console.log('error:', err.stack);
});