mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
Use orderedMap for language books
This commit is contained in:
@@ -161,6 +161,20 @@ Book.prototype.isMultilingual = function() {
|
||||
return (this.getLanguages().getList().size > 0);
|
||||
};
|
||||
|
||||
/**
|
||||
Add a new language book
|
||||
|
||||
@param {String} language
|
||||
@param {Book} book
|
||||
@return {Book}
|
||||
*/
|
||||
Book.prototype.addLanguageBook = function(language, book) {
|
||||
var books = this.getBooks();
|
||||
books = books.set(language, book);
|
||||
|
||||
return this.set('books', books);
|
||||
};
|
||||
|
||||
/**
|
||||
Change log level
|
||||
|
||||
|
||||
@@ -39,10 +39,7 @@ function parseMultilingualBook(book) {
|
||||
.then(parseConfig)
|
||||
.then(parseBookContent)
|
||||
.then(function(result) {
|
||||
var books = currentBook.getBooks();
|
||||
books = books.push(result);
|
||||
|
||||
return currentBook.set('books', books);
|
||||
return currentBook.addLanguageBook(lang, result);
|
||||
});
|
||||
}, book);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user