diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/backbone/langs.js | 16 | ||||
-rw-r--r-- | lib/output/base.js | 1 | ||||
-rw-r--r-- | lib/page/index.js | 1 |
3 files changed, 18 insertions, 0 deletions
diff --git a/lib/backbone/langs.js b/lib/backbone/langs.js index a40bd80..e339fa9 100644 --- a/lib/backbone/langs.js +++ b/lib/backbone/langs.js @@ -62,4 +62,20 @@ Langs.prototype.count = function() { return _.size(this.languages); }; +// Return templating context for the languages list +Langs.prototype.getContext = function() { + if (this.count() == 0) return {}; + + return { + languages: { + list: _.map(this.languages, function(lang) { + return { + id: lang.id, + title: lang.title + }; + }) + } + }; +}; + module.exports = Langs; diff --git a/lib/output/base.js b/lib/output/base.js index 77c2d9f..fb0adca 100644 --- a/lib/output/base.js +++ b/lib/output/base.js @@ -202,6 +202,7 @@ Output.prototype.getContext = function() { return _.extend( {}, this.book.getContext(), + this.book.langs.getContext(), this.book.summary.getContext(), this.book.glossary.getContext(), this.book.config.getContext() diff --git a/lib/page/index.js b/lib/page/index.js index 45b3598..b512ff4 100644 --- a/lib/page/index.js +++ b/lib/page/index.js @@ -128,6 +128,7 @@ Page.prototype.getContext = function() { }, gitbook.getContext(), this.book.getContext(), + this.book.langs.getContext(), this.book.summary.getContext(), this.book.glossary.getContext(), this.book.config.getContext() |