diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-01-19 15:05:13 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-01-19 15:05:13 +0100 |
commit | 8569a741033be6bb3dbfd6fd9ecd3c03f05319c3 (patch) | |
tree | 17615db0d7a73b8ef41c6901c768e8aaf13cf4c9 /lib/book.js | |
parent | b314972195b18df43ad3eba6266ae1ba1b1873e3 (diff) | |
download | gitbook-8569a741033be6bb3dbfd6fd9ecd3c03f05319c3.zip gitbook-8569a741033be6bb3dbfd6fd9ecd3c03f05319c3.tar.gz gitbook-8569a741033be6bb3dbfd6fd9ecd3c03f05319c3.tar.bz2 |
Use template before parsing glossary, summary and langs
Diffstat (limited to 'lib/book.js')
-rw-r--r-- | lib/book.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/book.js b/lib/book.js index 8c3561a..0f5d452 100644 --- a/lib/book.js +++ b/lib/book.js @@ -90,7 +90,7 @@ Book.prototype.parseLangs = function() { .then(function(langs) { if (!langs) return []; - return that.readFile(langs.path) + return that.template.renderFile(langs.path) .then(function(content) { return langs.parser.langs(content); }); @@ -108,7 +108,7 @@ Book.prototype.parseSummary = function() { .then(function(summary) { if (!summary) throw "No SUMMARY file"; - return that.readFile(summary.path) + return that.template.renderFile(summary.path) .then(function(content) { return summary.parser.summary(content); }); @@ -126,7 +126,7 @@ Book.prototype.parseGlossary = function() { .then(function(glossary) { if (!glossary) return {}; - return that.readFile(glossary.path) + return that.template.renderFile(glossary.path) .then(function(content) { return glossary.parser.glossary(content); }); @@ -174,4 +174,9 @@ Book.prototype.readFile = function(filename) { ); }; +// Return stat for a file +Book.prototype.statFile = function(filename) { + return fs.stat(path.join(this.root, filename)); +}; + module.exports= Book; |