summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/book.js14
-rw-r--r--lib/output/base.js1
-rw-r--r--lib/plugins/compatibility.js14
3 files changed, 16 insertions, 13 deletions
diff --git a/lib/book.js b/lib/book.js
index 400296e..a678181 100644
--- a/lib/book.js
+++ b/lib/book.js
@@ -92,6 +92,20 @@ function Book(opts) {
// List of page in the book
this.pages = {};
+ // Deprecation for templates
+ Object.defineProperty(this, 'options', {
+ get: function () {
+ this.log.warn.ln('"options" property is deprecated, use config.get(key) instead');
+ var cfg = this.config.dump();
+ error.deprecateField(cfg, 'book', (this.output? this.output.name : null), '"options.generator" property is deprecated, use "output.name" instead');
+
+ return cfg;
+ }
+ });
+
+ // Loop for template filters/blocks
+ error.deprecateField(this, 'book', this, '"book" property is deprecated, use "this" directly instead');
+
_.bindAll(this);
}
diff --git a/lib/output/base.js b/lib/output/base.js
index a1d8804..e63c872 100644
--- a/lib/output/base.js
+++ b/lib/output/base.js
@@ -24,6 +24,7 @@ function Output(book, opts, parent) {
});
this.book = book;
+ book.output = this;
this.log = this.book.log;
// Create plugins manager
diff --git a/lib/plugins/compatibility.js b/lib/plugins/compatibility.js
index 7ad35a9..9f80c38 100644
--- a/lib/plugins/compatibility.js
+++ b/lib/plugins/compatibility.js
@@ -7,19 +7,7 @@ var error = require('../utils/error');
*/
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');
+ var ctx = book;
return ctx;
}