diff options
-rw-r--r-- | lib/parsers.js | 6 | ||||
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | test/fixtures/test3/README.adoc | 4 | ||||
-rw-r--r-- | test/fixtures/test3/SUMMARY.adoc | 5 | ||||
-rw-r--r-- | test/fixtures/test3/test.adoc | 0 | ||||
-rw-r--r-- | test/fixtures/test3/test1.adoc | 0 | ||||
-rw-r--r-- | test/fixtures/test3/test3.adoc | 0 | ||||
-rw-r--r-- | test/helper.js | 6 | ||||
-rw-r--r-- | test/parsing.js | 5 |
9 files changed, 26 insertions, 1 deletions
diff --git a/lib/parsers.js b/lib/parsers.js index da9732a..523cb87 100644 --- a/lib/parsers.js +++ b/lib/parsers.js @@ -4,8 +4,14 @@ var path = require("path"); // This list is ordered by priority of parsers to use var PARSER = [ { + name: "markdown", extensions: [".md", ".markdown"], parser: require("gitbook-markdown") + }, + { + name: "asciidoc", + extensions: [".adoc", ".asciidoc"], + parser: require("gitbook-asciidoc") } ]; diff --git a/package.json b/package.json index 0e4d93b..1037a6f 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "fs-extra": "0.14.0", "fstream-ignore": "1.0.2", "gitbook-markdown": "1.0.0", + "gitbook-asciidoctor": "1.0.0", "nunjucks": "git+https://github.com/SamyPesse/nunjucks.git#4019d1b7379372336b86ce1b0bf84352a2029747", "semver": "2.2.1", "npmi": "0.1.1", diff --git a/test/fixtures/test3/README.adoc b/test/fixtures/test3/README.adoc new file mode 100644 index 0000000..ea295ee --- /dev/null +++ b/test/fixtures/test3/README.adoc @@ -0,0 +1,4 @@ += My Book + +Test description + diff --git a/test/fixtures/test3/SUMMARY.adoc b/test/fixtures/test3/SUMMARY.adoc new file mode 100644 index 0000000..29fcb65 --- /dev/null +++ b/test/fixtures/test3/SUMMARY.adoc @@ -0,0 +1,5 @@ += Summary + +. link:test.adoc[Chapter 1] +.. link:test1.adoc[Article 1] +. link:test2.adoc[Chapter 2] diff --git a/test/fixtures/test3/test.adoc b/test/fixtures/test3/test.adoc new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/fixtures/test3/test.adoc diff --git a/test/fixtures/test3/test1.adoc b/test/fixtures/test3/test1.adoc new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/fixtures/test3/test1.adoc diff --git a/test/fixtures/test3/test3.adoc b/test/fixtures/test3/test3.adoc new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/fixtures/test3/test3.adoc diff --git a/test/helper.js b/test/helper.js index 74f461a..f29b3c7 100644 --- a/test/helper.js +++ b/test/helper.js @@ -15,12 +15,16 @@ global.qdone = function qdone(promise, done) { before(function(done) { global.book1 = new Book(path.join(__dirname, './fixtures/test1')); global.book2 = new Book(path.join(__dirname, './fixtures/test2')); + global.book3 = new Book(path.join(__dirname, './fixtures/test3')); qdone( global.book1.parse() .then(function() { return global.book2.parse(); - }), + }) + .then(function() { + return global.book3.parse(); + }), done ); }); diff --git a/test/parsing.js b/test/parsing.js index 4e76d2c..7be50cd 100644 --- a/test/parsing.js +++ b/test/parsing.js @@ -8,6 +8,11 @@ describe('Book parsing', function () { assert.equal(book1.options.description, 'Test description'); }); + it('should correctly parse the readme with asciidoc', function() { + assert.equal(book3.options.title, 'My Book'); + assert.equal(book3.options.description, 'Test description'); + }); + it('should correctly parse the summary', function() { var LEXED = book1.summary; |