summaryrefslogtreecommitdiffstats
path: root/lib/generate/site/index.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2014-04-28 17:21:06 +0200
committerSamy Pessé <samypesse@gmail.com>2014-04-28 17:21:06 +0200
commit38fea06cf96360a08a0b704715436d6136797cb6 (patch)
treeadcf9d10770e3eed48864ddbc73cf254611c8836 /lib/generate/site/index.js
parent4481b5f556937ad9980b1697421fbeb2433f45a0 (diff)
downloadgitbook-38fea06cf96360a08a0b704715436d6136797cb6.zip
gitbook-38fea06cf96360a08a0b704715436d6136797cb6.tar.gz
gitbook-38fea06cf96360a08a0b704715436d6136797cb6.tar.bz2
Use hook to allow plugins to edit page content during generation (Fixes #176)
Diffstat (limited to 'lib/generate/site/index.js')
-rw-r--r--lib/generate/site/index.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/generate/site/index.js b/lib/generate/site/index.js
index f8986df..f0ed784 100644
--- a/lib/generate/site/index.js
+++ b/lib/generate/site/index.js
@@ -124,13 +124,20 @@ Generator.prototype.convertFile = function(content, _input) {
});
})
.then(function(sections) {
+ // Use plugin hook
+ return that.callHook("page", {
+ sections: sections,
+ progress: progress
+ })
+ })
+ .then(function(_page) {
that.manifest.add("CACHE", _output);
return that._writeTemplate(that.template, {
- progress: progress,
+ progress: _page.progress,
_input: _input,
- content: sections,
+ content: _page.sections,
basePath: basePath,
staticBase: path.join(basePath, "gitbook"),