summaryrefslogtreecommitdiffstats
path: root/lib/output/base.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/output/base.js')
-rw-r--r--lib/output/base.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/output/base.js b/lib/output/base.js
index 4190559..828a11e 100644
--- a/lib/output/base.js
+++ b/lib/output/base.js
@@ -7,7 +7,6 @@ var pathUtil = require('../utils/path');
var location = require('../utils/location');
var PluginsManager = require('../plugins');
var TemplateEngine = require('../template');
-var gitbook = require('../gitbook');
/*
Output is like a stream interface for a parsed book
@@ -16,9 +15,13 @@ to output "something".
The process is mostly on the behavior of "onPage" and "onAsset"
*/
-function Output(book) {
+function Output(book, opts) {
_.bindAll(this);
+ this.opts = _.defaults(opts || {}, {
+
+ });
+
this.book = book;
this.log = this.book.log;
@@ -175,6 +178,17 @@ Output.prototype.onResolveTemplate = function(from, to) {
// ---- Utilities ----
+// Return a default context for templates
+Output.prototype.getContext = function() {
+ return _.extend(
+ {},
+ this.book.getContext(),
+ this.book.summary.getContext(),
+ this.book.glossary.getContext(),
+ this.book.config.getContext()
+ );
+};
+
// Resolve a file path in the context of a specific page
// Result is an "absolute path relative to the output folder"
Output.prototype.resolveForPage = function(page, href) {