mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-18 00:25:07 +00:00
31 lines
574 B
JavaScript
31 lines
574 B
JavaScript
var util = require('util');
|
|
var Generator = require('./base');
|
|
|
|
function JSONGenerator() {
|
|
Generator.apply(this, arguments);
|
|
}
|
|
util.inherits(JSONGenerator, Generator);
|
|
|
|
// Write a page (parsable file)
|
|
JSONGenerator.prototype.writePage = function(page) {
|
|
var that = this;
|
|
|
|
// Parse the page
|
|
return page.parse()
|
|
|
|
// Write as json
|
|
.then(function() {
|
|
var json = {};
|
|
|
|
return that.output.writeFile(
|
|
page.withExtension('.json'),
|
|
JSON.stringify(json, null, 4)
|
|
);
|
|
});
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = JSONGenerator;
|