summaryrefslogtreecommitdiffstats
path: root/lib/book.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-01-28 23:42:00 +0100
committerSamy Pessé <samypesse@gmail.com>2016-01-28 23:42:00 +0100
commite83d63c2aa5e30c26ada888990b263e6b786d3f6 (patch)
treeaf460422630bfbaa9016c51d5ec384fa3923d01d /lib/book.js
parentff30ba62ba694658d1575b0cf3a0fbf3d5e00d62 (diff)
downloadgitbook-e83d63c2aa5e30c26ada888990b263e6b786d3f6.zip
gitbook-e83d63c2aa5e30c26ada888990b263e6b786d3f6.tar.gz
gitbook-e83d63c2aa5e30c26ada888990b263e6b786d3f6.tar.bz2
Index page of summary when parsing
Diffstat (limited to 'lib/book.js')
-rw-r--r--lib/book.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/book.js b/lib/book.js
index ce368a3..913df2f 100644
--- a/lib/book.js
+++ b/lib/book.js
@@ -168,6 +168,8 @@ Book.prototype.parse = function() {
}
return Promise()
+
+ // Parse the readme
.then(that.readme.load)
.then(function() {
if (that.readme.exists()) return;
@@ -175,13 +177,21 @@ Book.prototype.parse = function() {
throw new Error('No README file (or is ignored)');
})
+ // Parse the summary
.then(that.summary.load)
.then(function() {
- if (that.summary.exists()) return;
+ if (!that.summary.exists()) {
+ throw new Error('No SUMMARY file (or is ignored)');
+ }
- throw new Error('No SUMMARY file (or is ignored)');
+ // Index summary's articles
+ that.summary.walk(function(article) {
+ if (!article.hasLocation()) return;
+ that.addPage(article.filename);
+ });
})
+ // Parse the glossary
.then(that.glossary.load);
});
};