summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-02-17 21:25:08 +0100
committerSamy Pesse <samypesse@gmail.com>2016-02-17 21:25:08 +0100
commit1ec8b7c32403c2252ea379c327349fcc937b57fc (patch)
treefa775c37a183a376af09a0c3e25b44d6432a84bb
parente75002a96d00f608f75236344ceb4434c487d863 (diff)
downloadgitbook-1ec8b7c32403c2252ea379c327349fcc937b57fc.zip
gitbook-1ec8b7c32403c2252ea379c327349fcc937b57fc.tar.gz
gitbook-1ec8b7c32403c2252ea379c327349fcc937b57fc.tar.bz2
Add glossary as a normal page
-rw-r--r--lib/book.js8
-rw-r--r--test/parse.js11
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/book.js b/lib/book.js
index d0e415c..acfaece 100644
--- a/lib/book.js
+++ b/lib/book.js
@@ -216,7 +216,13 @@ Book.prototype.parse = function() {
})
// Parse the glossary
- .then(that.glossary.load);
+ .then(that.glossary.load)
+
+ // Add the glossary as a page
+ .then(function() {
+ if (!that.glossary.exists()) return;
+ that.addPage(that.glossary.path);
+ });
});
};
diff --git a/test/parse.js b/test/parse.js
index 72e0260..e190107 100644
--- a/test/parse.js
+++ b/test/parse.js
@@ -19,6 +19,17 @@ describe('Parsing', function() {
});
});
+ it('should add GLOSSARY as a page', function() {
+ return mock.setupDefaultBook({
+ 'GLOSSARY.md': ''
+ })
+ .then(function(book) {
+ return book.parse()
+ .then(function() {
+ book.hasPage('GLOSSARY.md').should.equal(true);
+ });
+ });
+ });
describe('Multilingual book', function() {
var book;