summaryrefslogtreecommitdiffstats
path: root/lib/generators/json.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-01-29 12:21:57 +0100
committerSamy Pessé <samypesse@gmail.com>2016-01-29 12:21:57 +0100
commitf32d03eb88d66b37874c461c6327b4576327b4db (patch)
tree98f3b91bb216731e2cb4f583f9f6d38d126377b2 /lib/generators/json.js
parente83d63c2aa5e30c26ada888990b263e6b786d3f6 (diff)
downloadgitbook-f32d03eb88d66b37874c461c6327b4576327b4db.zip
gitbook-f32d03eb88d66b37874c461c6327b4576327b4db.tar.gz
gitbook-f32d03eb88d66b37874c461c6327b4576327b4db.tar.bz2
Add base for loading plugins
Diffstat (limited to 'lib/generators/json.js')
-rw-r--r--lib/generators/json.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/generators/json.js b/lib/generators/json.js
index d2c6954..b76a62e 100644
--- a/lib/generators/json.js
+++ b/lib/generators/json.js
@@ -8,10 +8,20 @@ util.inherits(JSONGenerator, Generator);
// Write a page (parsable file)
JSONGenerator.prototype.writePage = function(page) {
- var json = {};
+ var that = this;
+ // Parse the page
+ return page.parse()
- return this.output.writeFile(page.withExtension('.json'), JSON.stringify(json, null, 4));
+ // Write as json
+ .then(function() {
+ var json = {};
+
+ return this.output.writeFile(
+ page.withExtension('.json'),
+ JSON.stringify(json, null, 4)
+ );
+ });
};