summaryrefslogtreecommitdiffstats
path: root/lib/output
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-17 13:12:34 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-17 13:12:34 +0100
commitb6104c64fecb72c9f40554600d456c27dbd18be8 (patch)
tree0c48caf160f8b8a2c54f4cfa76c0f586364dbc8b /lib/output
parente95678cf3a3cfbcbfa8b64ca16c4030417187e88 (diff)
downloadgitbook-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.js6
-rw-r--r--lib/output/json.js10
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'),