summaryrefslogtreecommitdiffstats
path: root/lib/plugins
diff options
context:
space:
mode:
authorJohan Preynat <johan.preynat@gmail.com>2016-04-13 09:33:26 +0200
committerJohan Preynat <johan.preynat@gmail.com>2016-04-13 09:33:26 +0200
commit53cfa3703b0ab9756dd773fb5fe7de2b9cbf0085 (patch)
tree358279e35e390c063fa306fca2018ff865c57f15 /lib/plugins
parent7ed9e8d145171b035ddae759e461a2f845af01e7 (diff)
downloadgitbook-53cfa3703b0ab9756dd773fb5fe7de2b9cbf0085.zip
gitbook-53cfa3703b0ab9756dd773fb5fe7de2b9cbf0085.tar.gz
gitbook-53cfa3703b0ab9756dd773fb5fe7de2b9cbf0085.tar.bz2
Update page context for plugins hooks
Diffstat (limited to 'lib/plugins')
-rw-r--r--lib/plugins/compatibility.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/plugins/compatibility.js b/lib/plugins/compatibility.js
index 9f80c38..eb64e48 100644
--- a/lib/plugins/compatibility.js
+++ b/lib/plugins/compatibility.js
@@ -14,12 +14,13 @@ function pluginCtx(plugin) {
// Call a function "fn" with a context of page similar to the one in GitBook v2
function pageHook(page, fn) {
- var ctx = {
- type: page.type,
- content: page.content,
- path: page.path,
- rawPath: page.rawPath
- };
+ // Get page context
+ var ctx = page.getContext().page;
+
+ // Add other informations
+ ctx.type = page.type;
+ ctx.rawPath = page.rawPath;
+ ctx.path = page.path;
// Deprecate sections
error.deprecateField(ctx, 'sections', [