Fix version in generator tag

This commit is contained in:
Samy Pessé
2015-01-23 16:04:10 +01:00
parent 77834f8166
commit c47166d700
2 changed files with 13 additions and 2 deletions
+6
View File
@@ -12,6 +12,8 @@ var BaseGenerator = require("../generator");
var links = require("../utils/links");
var pageUtil = require("../utils/page");
var pkg = require("../../package.json");
var Generator = function() {
BaseGenerator.apply(this, arguments);
@@ -181,6 +183,10 @@ Generator.prototype._writeTemplate = function(tpl, options, output, interpolate)
return that.env.render(
tpl,
_.extend({
gitbook: {
version: pkg.version
},
styles: that.styles,
revision: that.revision,
+7 -2
View File
@@ -1,8 +1,8 @@
var _ = require("lodash");
var Q = require("q");
var nunjucks = require("nunjucks");
var pkg = require("../package.json");
var TemplateEngine = function(book) {
this.book = book;
@@ -31,7 +31,12 @@ TemplateEngine.prototype.renderFile = function(filename) {
file: {
path: filename,
mtime: stat.mtime
}
},
// infos about gitbook
gitbook: {
version: pkg.version
}
};
return Q.nfcall(that.env.render.bind(that.env), filename, context);