diff options
Diffstat (limited to 'lib/generate/page/index.js')
-rw-r--r-- | lib/generate/page/index.js | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/generate/page/index.js b/lib/generate/page/index.js index bd9b233..a013219 100644 --- a/lib/generate/page/index.js +++ b/lib/generate/page/index.js @@ -15,6 +15,9 @@ var BaseGenerator = require("../site"); var Generator = function() { BaseGenerator.apply(this, arguments); + // Base for assets in plugins + this.pluginAssetsBase = "ebook"; + // List of pages content this.pages = {}; }; @@ -34,6 +37,14 @@ Generator.prototype.convertFile = function(content, input) { progress: parse.progress(this.options.navigation, input) }; + var _callHook = function(name) { + return that.callHook(name, json) + .then(function(_page) { + json = _page; + return json; + }); + }; + return Q() .then(function() { return parse.page(content, { @@ -46,6 +57,11 @@ Generator.prototype.convertFile = function(content, input) { .then(function(sections) { json.content = sections; }) + .then(function(sections) { + + // Use plugin hook + return _callHook("ebook:page"); + }) .then(function() { that.pages[input] = json; }); @@ -82,10 +98,7 @@ Generator.prototype.finish = function() { // Copy assets .then(function() { - return fs.copy( - path.join(that.options.theme, "assets"), - path.join(that.options.output, "gitbook") - ); + return that.copyAssets(); }); }; |