summaryrefslogtreecommitdiffstats
path: root/lib/generate/page/index.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2014-09-17 13:00:28 +0200
committerSamy Pessé <samypesse@gmail.com>2014-09-17 13:00:28 +0200
commitc8c07fe8ce7ccc3b4a83412025123cc05853dc40 (patch)
tree96e167b96d43d259cbdc6723fd6fafac84920db7 /lib/generate/page/index.js
parent9dc19026c6c849ee545204b5aecd84b22e7e8d84 (diff)
downloadgitbook-c8c07fe8ce7ccc3b4a83412025123cc05853dc40.zip
gitbook-c8c07fe8ce7ccc3b4a83412025123cc05853dc40.tar.gz
gitbook-c8c07fe8ce7ccc3b4a83412025123cc05853dc40.tar.bz2
Add base to use plugins in page format
Diffstat (limited to 'lib/generate/page/index.js')
-rw-r--r--lib/generate/page/index.js21
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();
});
};