summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/output/base.js11
-rw-r--r--lib/output/ebook.js9
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/output/base.js b/lib/output/base.js
index 9c2153d..201eade 100644
--- a/lib/output/base.js
+++ b/lib/output/base.js
@@ -221,10 +221,19 @@ Output.prototype.onLanguageBook = function(book) {
// ---- Utilities ----
+// Return conetxt for the output itself
+Output.prototype.getSelfContext = function() {
+ return {
+ name: this.name
+ };
+};
+
// Return a default context for templates
Output.prototype.getContext = function() {
return _.extend(
- {},
+ {
+ output: this.getSelfContext()
+ },
this.book.getContext(),
this.book.langs.getContext(),
this.book.summary.getContext(),
diff --git a/lib/output/ebook.js b/lib/output/ebook.js
index ace5255..b0b05ca 100644
--- a/lib/output/ebook.js
+++ b/lib/output/ebook.js
@@ -21,6 +21,15 @@ var EbookOutput = assetsInliner(_EbookOutput);
EbookOutput.prototype.name = 'ebook';
+// Return context for templating
+// Incldue type of ebbook generated
+EbookOutput.prototype.getSelfContext = function() {
+ var ctx = EbookOutput.super_.prototype.getSelfContext.apply(this);
+ ctx.format = this.opts.format;
+
+ return ctx;
+};
+
// Finish generation, create ebook using ebook-convert
EbookOutput.prototype.finish = function() {
var that = this;