summaryrefslogtreecommitdiffstats
path: root/lib/generators/json.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-01-19 20:54:59 +0100
committerSamy Pessé <samypesse@gmail.com>2015-01-19 20:54:59 +0100
commitb549158483de1336b8b48a1ccbb5c87ea54e8b34 (patch)
treecd80478f807b30923bd7cf9008d3073ba7f070a8 /lib/generators/json.js
parent9a2b03b1835ca14239b61fb7b8610c782bb460e7 (diff)
downloadgitbook-b549158483de1336b8b48a1ccbb5c87ea54e8b34.zip
gitbook-b549158483de1336b8b48a1ccbb5c87ea54e8b34.tar.gz
gitbook-b549158483de1336b8b48a1ccbb5c87ea54e8b34.tar.bz2
Parse navigation and progress in parsed page
Diffstat (limited to 'lib/generators/json.js')
-rw-r--r--lib/generators/json.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/generators/json.js b/lib/generators/json.js
index 6dc468e..2e8c731 100644
--- a/lib/generators/json.js
+++ b/lib/generators/json.js
@@ -20,7 +20,7 @@ Generator.prototype.finish = function() { };
Generator.prototype.writeParsedFile = function(page, input) {
var that = this;
var json = {
- progress: [],
+ progress: page.progress,
sections: page.sections
};
@@ -45,16 +45,19 @@ Generator.prototype.langsIndex = function(langs) {
return Q()
.then(function() {
+ // Read readme from main language
return fs.readFile(
path.join(that.options.output, mainLang, readme)
);
})
.then(function(content) {
+ // Extend it with infos about the languages
var json = JSON.parse(content);
_.extend(json, {
langs: langs
});
+ // Write it as README.json
return fs.writeFile(
path.join(that.options.output, "README.json"),
JSON.stringify(json, null, 4)