diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-17 13:39:20 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-17 13:39:20 +0100 |
commit | 96105d6ba0ac1bc86bd34088ae4763bf09b3c3ea (patch) | |
tree | babef2d655f326e71be04ce2420373ba5e390fd4 /lib/book.js | |
parent | 853ba6079c37aa747721c8ee5d014479e69f3ad9 (diff) | |
download | gitbook-96105d6ba0ac1bc86bd34088ae4763bf09b3c3ea.zip gitbook-96105d6ba0ac1bc86bd34088ae4763bf09b3c3ea.tar.gz gitbook-96105d6ba0ac1bc86bd34088ae4763bf09b3c3ea.tar.bz2 |
Extend templating context (and json output)
Diffstat (limited to 'lib/book.js')
-rw-r--r-- | lib/book.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/book.js b/lib/book.js index 173e9cc..7928f24 100644 --- a/lib/book.js +++ b/lib/book.js @@ -92,6 +92,18 @@ function Book(opts) { _.bindAll(this); } +// Return templating context for the book +Book.prototype.getContext = function() { + var variables = this.config.get('variables', {}); + + return { + book: _.extend({ + title: this.config.get('title'), + description: this.config.get('description') + }, variables) + }; +}; + // Parse and prepare the configuration, fail if invalid Book.prototype.prepareConfig = function() { return this.config.load(); |