summaryrefslogtreecommitdiffstats
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
parent7ed9e8d145171b035ddae759e461a2f845af01e7 (diff)
downloadgitbook-53cfa3703b0ab9756dd773fb5fe7de2b9cbf0085.zip
gitbook-53cfa3703b0ab9756dd773fb5fe7de2b9cbf0085.tar.gz
gitbook-53cfa3703b0ab9756dd773fb5fe7de2b9cbf0085.tar.bz2
Update page context for plugins hooks
-rw-r--r--lib/page/index.js1
-rw-r--r--lib/plugins/compatibility.js13
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/page/index.js b/lib/page/index.js
index bcd83e6..f0d7f57 100644
--- a/lib/page/index.js
+++ b/lib/page/index.js
@@ -7,7 +7,6 @@ var error = require('../utils/error');
var pathUtil = require('../utils/path');
var location = require('../utils/location');
var parsers = require('../parsers');
-var gitbook = require('../gitbook');
var pluginCompatibility = require('../plugins/compatibility');
var HTMLPipeline = require('./html');
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', [