mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
Hooks for summary data
This commit is contained in:
+24
-6
@@ -271,13 +271,31 @@ var generateBook = function(options) {
|
||||
|
||||
// Get summary
|
||||
.then(function() {
|
||||
return fs.readFile(path.join(options.input, "SUMMARY.md"), "utf-8")
|
||||
.then(function(_summary) {
|
||||
options.summary = parse.summary(_summary);
|
||||
var summary = {
|
||||
path: path.join(options.input, "SUMMARY.md")
|
||||
};
|
||||
|
||||
// Parse navigation
|
||||
options.navigation = parse.navigation(options.summary);
|
||||
});
|
||||
var _callHook = function(name) {
|
||||
return generator.callHook(name, summary)
|
||||
.then(function(_summary) {
|
||||
summary = _summary;
|
||||
return summary;
|
||||
});
|
||||
};
|
||||
|
||||
return fs.readFile(summary.path, "utf-8")
|
||||
.then(function(_content) {
|
||||
summary.content = _content;
|
||||
return _callHook("summary:before");
|
||||
})
|
||||
.then(function() {
|
||||
summary.content = parse.summary(summary.content);
|
||||
return _callHook("summary:after");
|
||||
})
|
||||
.then(function() {
|
||||
options.summary = summary.content;
|
||||
options.navigation = parse.navigation(options.summary);
|
||||
})
|
||||
})
|
||||
|
||||
// Skip processing some files
|
||||
|
||||
Reference in New Issue
Block a user