mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-17 08:05:19 +00:00
28 lines
661 B
JavaScript
28 lines
661 B
JavaScript
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;
|