diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-03-09 15:50:38 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-03-09 15:50:38 +0100 |
commit | c499a8a13a3059e3953727866beb7c986e46dd78 (patch) | |
tree | 173ee93cb957446855d8519335ad5dba0f7cc332 /lib/page/index.js | |
parent | 64a6de751d0f2bd8910ce36e2e8aa4049316e2c7 (diff) | |
download | gitbook-c499a8a13a3059e3953727866beb7c986e46dd78.zip gitbook-c499a8a13a3059e3953727866beb7c986e46dd78.tar.gz gitbook-c499a8a13a3059e3953727866beb7c986e46dd78.tar.bz2 |
Add back gitbook.generator property as deprecated
Diffstat (limited to 'lib/page/index.js')
-rw-r--r-- | lib/page/index.js | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/lib/page/index.js b/lib/page/index.js index 6c63489..0377f35 100644 --- a/lib/page/index.js +++ b/lib/page/index.js @@ -116,30 +116,27 @@ Page.prototype.getContext = function() { if (dir == 'neutral') dir = null; } - return _.extend( - { - file: { - path: this.path, - mtime: this.mtime, - type: this.type - }, - page: _.extend({}, this.attributes, { - title: article? article.title : null, - next: next? next.getContext() : null, - previous: prev? prev.getContext() : null, - level: article? article.level : null, - depth: article? article.depth : 0, - content: this.content, - dir: dir - }) + return { + file: { + path: this.path, + mtime: this.mtime, + type: this.type }, - gitbook.getContext(), - this.book.getContext(), - this.book.langs.getContext(), - this.book.summary.getContext(), - this.book.glossary.getContext(), - this.book.config.getContext() - ); + page: _.extend({}, this.attributes, { + title: article? article.title : null, + next: next? next.getContext() : null, + previous: prev? prev.getContext() : null, + level: article? article.level : null, + depth: article? article.depth() : 0, + content: this.content, + dir: dir + }) + }; +}; + +// Return complete context for templating (page + book + summary + ...) +Page.prototype.getOutputContext = function(output) { + return _.extend({}, this.getContext(), output.getContext()); }; // Parse the page and return its content @@ -184,7 +181,7 @@ Page.prototype.toHTML = function(output) { // Render template .then(function() { - return output.template.render(that.content, that.getContext(), { + return output.template.render(that.content, that.getOutputContext(output), { path: that.path }) .then(that.update); |