diff options
-rw-r--r-- | lib/book.js | 5 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | test/fixtures/test1/SUMMARY.md | 2 | ||||
-rw-r--r-- | test/parsing.js | 12 |
4 files changed, 18 insertions, 3 deletions
diff --git a/lib/book.js b/lib/book.js index c81d38f..bde30da 100644 --- a/lib/book.js +++ b/lib/book.js @@ -319,7 +319,10 @@ Book.prototype.parseSummary = function() { that.logDebug("summary located at", summary.path); return that.template.renderFile(summary.path) .then(function(content) { - return summary.parser.summary(content, that.readmeFile); + return summary.parser.summary(content, { + entryPoint: that.readmeFile, + files: that.files + }); }); }) .then(function(summary) { diff --git a/package.json b/package.json index 27f69ff..662f168 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "resolve": "0.6.3", "fs-extra": "0.14.0", "fstream-ignore": "1.0.2", - "gitbook-parsers": "0.1.0", + "gitbook-parsers": "0.2.0", "nunjucks": "git+https://github.com/SamyPesse/nunjucks.git#4019d1b7379372336b86ce1b0bf84352a2029747", "nunjucks-autoescape": "0.1.0", "nunjucks-filter": "0.1.0", diff --git a/test/fixtures/test1/SUMMARY.md b/test/fixtures/test1/SUMMARY.md index 4a87f8c..d05fc4a 100644 --- a/test/fixtures/test1/SUMMARY.md +++ b/test/fixtures/test1/SUMMARY.md @@ -3,4 +3,4 @@ * [Chapter 1](test.md) * [Article 1](sub/test1.md) * [Chapter 2](test2.md) - +* [Google](https://www.google.com) diff --git a/test/parsing.js b/test/parsing.js index 5f40594..0166e85 100644 --- a/test/parsing.js +++ b/test/parsing.js @@ -17,8 +17,20 @@ describe('Book parsing', function () { var LEXED = books[1].summary; assert.equal(LEXED.chapters[0].path, 'intro.md'); + assert.equal(LEXED.chapters[0].exists, true); + assert.equal(LEXED.chapters[0].external, false); + assert.equal(LEXED.chapters[1].path, 'test.md'); + assert.equal(LEXED.chapters[1].exists, false); + assert.equal(LEXED.chapters[1].external, false); + assert.equal(LEXED.chapters[2].path, 'test2.md'); + assert.equal(LEXED.chapters[2].exists, false); + assert.equal(LEXED.chapters[2].external, false); + + assert.equal(LEXED.chapters[3].path, 'https://www.google.com'); + assert.equal(LEXED.chapters[3].exists, true); + assert.equal(LEXED.chapters[3].external, true); }); it('should correctly parse the glossary', function() { |