summaryrefslogtreecommitdiffstats
path: root/lib/book.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-01-19 13:22:34 +0100
committerSamy Pessé <samypesse@gmail.com>2015-01-19 13:22:34 +0100
commit8ed9f645fc7bd7e79290dcf7c855df33d3cda262 (patch)
treefbe80af8c02b15c928327cd4f6e347bab29e8c77 /lib/book.js
parent60993d3123ef81f72e028dd496f26d3bbba0eec0 (diff)
downloadgitbook-8ed9f645fc7bd7e79290dcf7c855df33d3cda262.zip
gitbook-8ed9f645fc7bd7e79290dcf7c855df33d3cda262.tar.gz
gitbook-8ed9f645fc7bd7e79290dcf7c855df33d3cda262.tar.bz2
Fix parsing of langs
Add command to build
Diffstat (limited to 'lib/book.js')
-rw-r--r--lib/book.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/book.js b/lib/book.js
index 50ef252..991e126 100644
--- a/lib/book.js
+++ b/lib/book.js
@@ -22,10 +22,10 @@ var Book = function(root, options) {
this.summary = {};
// Glossary
- this.glossary = {};
+ this.glossary = [];
// Langs
- this.langs = {};
+ this.langs = [];
};
// Initialize and parse the book: config, summary, glossary
@@ -38,10 +38,10 @@ Book.prototype.init = function() {
.then(function() {
return that.parseLangs()
.then(function() {
- multilingal = that.langs.list.length > 0;
+ multilingal = that.langs.length > 0;
// Sub-books that inherit from the current book configuration
- that.books = _.map(that.langs.list, function(lang) {
+ that.books = _.map(that.langs, function(lang) {
return new Book(
path.join(that.root, lang.path),
_.extend({}, that.options, {
@@ -63,13 +63,23 @@ Book.prototype.init = function() {
.thenResolve(this);
};
+// Generate the output
+Book.prototype.generate = function() {
+ var that = this;
+
+ return this.init()
+ .then(function() {
+
+ });
+};
+
// Parse langs
Book.prototype.parseLangs = function() {
var that = this;
return that.findFile("LANGS")
.then(function(langs) {
- if (!langs) return {};
+ if (!langs) return [];
return that.readFile(langs.path)
.then(function(content) {