blob: 17cefb6d98f9dc6628c62e64bc9a5afeed0dc90d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
var error = require('../utils/error');
/*
Return the context for a plugin.
It tries to keep compatibilities with GitBook v2
*/
function pluginCtx(plugin) {
var book = plugin.book;
var ctx = {
config: book.config,
log: plugin.log,
// Paths
resolve: book.resolve
};
// Deprecation
error.deprecateField(ctx, 'options', book.config.dump(), '"options" property is deprecated, use config.get(key) instead');
// Loop for template filters/blocks
error.deprecateField(ctx, 'book', ctx, '"book" property is deprecated, use "this" directly instead');
return ctx;
}
module.exports = pluginCtx;
|