Update page context for plugins hooks

This commit is contained in:
Johan Preynat
2016-04-13 09:33:26 +02:00
parent 7ed9e8d145
commit 53cfa3703b
2 changed files with 7 additions and 7 deletions
-1
View File
@@ -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');
+7 -6
View File
@@ -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', [