mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-22 18:43:29 +00:00
Fix list of files and parsing of navigation files only
This commit is contained in:
+8
-7
@@ -33,6 +33,7 @@ var Book = function(root, options, parent) {
|
||||
|
||||
// Summary
|
||||
this.summary = {};
|
||||
this.navigation = [];
|
||||
|
||||
// Glossary
|
||||
this.glossary = [];
|
||||
@@ -83,6 +84,10 @@ Book.prototype.parse = function() {
|
||||
});
|
||||
})
|
||||
|
||||
.then(function() {
|
||||
if (multilingal) return;
|
||||
return that.listAllFiles();
|
||||
})
|
||||
.then(function() {
|
||||
if (multilingal) return;
|
||||
return that.parseReadme();
|
||||
@@ -95,10 +100,6 @@ Book.prototype.parse = function() {
|
||||
if (multilingal) return;
|
||||
return that.parseGlossary();
|
||||
})
|
||||
.then(function() {
|
||||
if (multilingal) return;
|
||||
return that.listAllFiles();
|
||||
})
|
||||
|
||||
.then(function() {
|
||||
// Init sub-books
|
||||
@@ -149,7 +150,7 @@ Book.prototype.generate = function(generator) {
|
||||
|
||||
if (file[file.length -1] == "/") {
|
||||
return Q(generator.transferFolder(file));
|
||||
} else if (_.contains(parsers.extensions, path.extname(file)) && 1) {
|
||||
} else if (_.contains(parsers.extensions, path.extname(file)) && that.navigation[file]) {
|
||||
return that.parsePage(file)
|
||||
.then(function(content) {
|
||||
return Q(generator.writeParsedFile(content, file));
|
||||
@@ -269,6 +270,7 @@ Book.prototype.parseSummary = function() {
|
||||
})
|
||||
.then(function(summary) {
|
||||
that.summary = summary;
|
||||
that.navigation = parseNavigation(that.summary, that.files);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -307,8 +309,7 @@ Book.prototype.parsePage = function(filename) {
|
||||
return filetype.parser.page(content);
|
||||
})
|
||||
.then(function(page) {
|
||||
page.navigation = parseNavigation(that.summary, that.files);
|
||||
page.progress = parseProgress(page.navigation, filename);
|
||||
page.progress = parseProgress(that.navigation, filename);
|
||||
return page;
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user