mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-24 11:26:31 +00:00
Update page context for plugins hooks
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
@@ -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', [
|
||||
|
||||
Reference in New Issue
Block a user