diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-17 13:12:34 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-17 13:12:34 +0100 |
commit | b6104c64fecb72c9f40554600d456c27dbd18be8 (patch) | |
tree | 0c48caf160f8b8a2c54f4cfa76c0f586364dbc8b /lib/output | |
parent | e95678cf3a3cfbcbfa8b64ca16c4030417187e88 (diff) | |
download | gitbook-b6104c64fecb72c9f40554600d456c27dbd18be8.zip gitbook-b6104c64fecb72c9f40554600d456c27dbd18be8.tar.gz gitbook-b6104c64fecb72c9f40554600d456c27dbd18be8.tar.bz2 |
Use same json for page context and json builds
Diffstat (limited to 'lib/output')
-rw-r--r-- | lib/output/base.js | 6 | ||||
-rw-r--r-- | lib/output/json.js | 10 |
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/output/base.js b/lib/output/base.js index 02a69b1..997b8da 100644 --- a/lib/output/base.js +++ b/lib/output/base.js @@ -82,10 +82,12 @@ Output.prototype.generate = function() { .value(); return Promise.serie(byTypes.asset, function(filename) { + that.log.info.ln('copy asset', filename); return that.onAsset(filename); }) .then(function() { return Promise.serie(byTypes.page, function(filename) { + that.log.info.ln('process page', filename); return that.onPage(that.book.getPage(filename)); }); }); @@ -94,6 +96,10 @@ Output.prototype.generate = function() { // Finish the generation .then(function() { return that.finish(); + }) + + .then(function() { + that.log.info.ln('generation finished with success!'); }); }; diff --git a/lib/output/json.js b/lib/output/json.js index 913bc2b..9e6cb3c 100644 --- a/lib/output/json.js +++ b/lib/output/json.js @@ -1,7 +1,7 @@ +var _ = require('lodash'); var gitbook = require('../gitbook'); var conrefsLoader = require('./conrefs'); - var JSONOutput = conrefsLoader(); JSONOutput.prototype.name = 'json'; @@ -18,13 +18,11 @@ JSONOutput.prototype.onPage = function(page) { // Write as json .then(function() { - var json = { + var json = _.extend(page.getContext(), { gitbook: { version: gitbook.version - }, - path: page.path, - sections: page.content - }; + } + }); return that.writeFile( page.withExtension('.json'), |