blob: 0cfaeb78b434e742aceeb6847b40a8a2d45b321d (
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
29
30
|
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;
|