diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/book.js | 11 | ||||
-rw-r--r-- | lib/index.js | 5 | ||||
-rw-r--r-- | lib/parser.js | 2 |
3 files changed, 13 insertions, 5 deletions
diff --git a/lib/book.js b/lib/book.js index 6c8fdbb..df19f74 100644 --- a/lib/book.js +++ b/lib/book.js @@ -39,7 +39,7 @@ var Book = function(root, options, parent) { }; // Initialize and parse the book: config, summary, glossary -Book.prototype.init = function() { +Book.prototype.parse = function() { var that = this; var multilingal = false; @@ -81,7 +81,7 @@ Book.prototype.init = function() { // Init sub-books return _.reduce(that.books, function(prev, book) { return prev.then(function() { - return book.init(); + return book.parse(); }); }, Q()); }) @@ -93,7 +93,7 @@ Book.prototype.init = function() { Book.prototype.generate = function() { var that = this; - return this.init() + return Q() .then(function() { }); @@ -219,4 +219,9 @@ Book.prototype.statFile = function(filename) { return fs.stat(path.join(this.root, filename)); }; +// Retrun true if the book is a multilingual book +Book.prototype.isMultilingual = function(filename) { + return this.books.length > 0; +}; + module.exports= Book; diff --git a/lib/index.js b/lib/index.js index 21bc6ff..8b7a390 100644 --- a/lib/index.js +++ b/lib/index.js @@ -19,7 +19,10 @@ module.exports = { 'output': output })); - return book.generate(); + return book.parse() + .then(function() { + return book.generate(); + }); } } ] diff --git a/lib/parser.js b/lib/parser.js index b4243e0..da9732a 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -1,7 +1,7 @@ var _ = require("lodash"); var path = require("path"); -// This list is ordered by priority of parser to use +// This list is ordered by priority of parsers to use var PARSER = [ { extensions: [".md", ".markdown"], |