summaryrefslogtreecommitdiffstats
path: root/lib/plugins
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-22 15:34:35 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-22 15:34:35 +0100
commit6653307fda137253cd10d4d4f6d2e010c1c0f604 (patch)
tree754d73e1dadc19e692bfce468e674cd66eff8a0a /lib/plugins
parent642ba72a1d0680107357083a79560c2ccc931457 (diff)
downloadgitbook-6653307fda137253cd10d4d4f6d2e010c1c0f604.zip
gitbook-6653307fda137253cd10d4d4f6d2e010c1c0f604.tar.gz
gitbook-6653307fda137253cd10d4d4f6d2e010c1c0f604.tar.bz2
Add tests for context of filters
Diffstat (limited to 'lib/plugins')
-rw-r--r--lib/plugins/context.js2
-rw-r--r--lib/plugins/plugin.js10
2 files changed, 3 insertions, 9 deletions
diff --git a/lib/plugins/context.js b/lib/plugins/context.js
index a192b7b..17cefb6 100644
--- a/lib/plugins/context.js
+++ b/lib/plugins/context.js
@@ -19,7 +19,7 @@ function pluginCtx(plugin) {
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, this directly instead');
+ error.deprecateField(ctx, 'book', ctx, '"book" property is deprecated, use "this" directly instead');
return ctx;
}
diff --git a/lib/plugins/plugin.js b/lib/plugins/plugin.js
index 0fbbab1..4901579 100644
--- a/lib/plugins/plugin.js
+++ b/lib/plugins/plugin.js
@@ -270,10 +270,7 @@ BookPlugin.prototype.getFilters = function() {
return _.mapValues(this.content.filters || {}, function(fn, filter) {
return function() {
- var ctx = _.extend(
- this,
- pluginCtx(that)
- );
+ var ctx = _.extend(pluginCtx(that), this);
return fn.apply(ctx, arguments);
};
@@ -289,10 +286,7 @@ BookPlugin.prototype.getBlocks = function() {
var fn = block.exec;
block.exec = function() {
- var ctx = _.extend(
- this,
- pluginCtx(that)
- );
+ var ctx = _.extend(pluginCtx(that), this);
return fn.apply(ctx, arguments);
};