summaryrefslogtreecommitdiffstats
path: root/lib/parse
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-04-28 15:20:25 +0200
committerSamy Pessé <samypesse@gmail.com>2016-04-28 15:20:25 +0200
commitcb3ee423c976c93d35e7e7c8722787bd69cb747e (patch)
tree0093154277a7aaf5bf64afb1b3982dfefe033fe8 /lib/parse
parent1360a744a72fc84dacde22283a8dc2687ff6c3cb (diff)
downloadgitbook-cb3ee423c976c93d35e7e7c8722787bd69cb747e.zip
gitbook-cb3ee423c976c93d35e7e7c8722787bd69cb747e.tar.gz
gitbook-cb3ee423c976c93d35e7e7c8722787bd69cb747e.tar.bz2
Add basic tests for json generator
Diffstat (limited to 'lib/parse')
-rw-r--r--lib/parse/parseSummary.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/parse/parseSummary.js b/lib/parse/parseSummary.js
index 0c07ac7..2c6186f 100644
--- a/lib/parse/parseSummary.js
+++ b/lib/parse/parseSummary.js
@@ -16,13 +16,15 @@ function parseSummary(book) {
return parseStructureFile(book, 'summary')
.spread(function(file, result) {
+ var summary;
+
if (!file) {
logger.warn.ln('no summary file in this book');
- return book;
+ summary = Summary();
+ } else {
+ logger.debug.ln('summary file found at', file.getPath());
+ summary = Summary.createFromParts(file, result.parts);
}
- logger.debug.ln('summary file found at', file.getPath());
-
- var summary = Summary.createFromParts(file, result.parts);
// Insert readme as first entry
var firstArticle = summary.getFirstArticle();