mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 23:55:20 +00:00
Parse glossary during build
This commit is contained in:
+31
-1
@@ -232,14 +232,44 @@ var generateBook = function(options) {
|
||||
.then(function() {
|
||||
options.summary = summary.content;
|
||||
options.navigation = parse.navigation(options.summary);
|
||||
});
|
||||
})
|
||||
|
||||
// Read glossary
|
||||
.then(function() {
|
||||
var glossary = {};
|
||||
|
||||
var _callHook = function(name) {
|
||||
return generator.callHook(name, glossary)
|
||||
.then(function(_glossary) {
|
||||
glossary = _glossary;
|
||||
return glossary;
|
||||
});
|
||||
};
|
||||
|
||||
return fs.readFile(path.join(options.input, "GLOSSARY.md"), "utf-8")
|
||||
.fail(function() {
|
||||
return "";
|
||||
})
|
||||
.then(function(_content) {
|
||||
glossary.content = _content;
|
||||
return _callHook("glossary:before");
|
||||
})
|
||||
.then(function() {
|
||||
glossary.content = parse.glossary(glossary.content);
|
||||
return _callHook("glossary:after");
|
||||
})
|
||||
.then(function() {
|
||||
options.glossary = glossary.content;
|
||||
});
|
||||
})
|
||||
|
||||
// Skip processing some files
|
||||
.then(function() {
|
||||
files = _.filter(files, function (file) {
|
||||
return !(
|
||||
file === 'SUMMARY.md'
|
||||
file === 'SUMMARY.md' ||
|
||||
file === 'GLOSSARY.md'
|
||||
);
|
||||
});
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user