diff options
-rw-r--r-- | lib/template/index.js | 20 | ||||
-rw-r--r-- | test/template.js | 5 |
2 files changed, 2 insertions, 23 deletions
diff --git a/lib/template/index.js b/lib/template/index.js index 8266572..bb8272c 100644 --- a/lib/template/index.js +++ b/lib/template/index.js @@ -6,7 +6,6 @@ var escapeStringRegexp = require('escape-string-regexp'); var Promise = require('../utils/promise'); var error = require('../utils/error'); -var gitbook = require('../gitbook'); var defaultBlocks = require('./blocks'); var Loader = require('./loader'); @@ -345,29 +344,10 @@ TemplateEngine.prototype.render = function(content, context, options) { path: null }); - // Setup context for the template - context = _.extend({}, context, { - // Variables from book.json - book: this.book.config.get('variables'), - - // Complete book.json - config: this.book.config.dump(), - - // infos about gitbook - gitbook: { - version: gitbook.version, - generator: this.book.config.get('generator') - } - }); - // Setup path and type if (options.path) { options.path = this.book.resolve(options.path); } - if (!context.type && options.path) { - var parser = parsers.get(path.extname(options.path)); - context.type = parser? parser.name : null; - } // Replace shortcuts content = this.applyShortcuts(options.type, content); diff --git a/test/template.js b/test/template.js index a76fe93..6eb2278 100644 --- a/test/template.js +++ b/test/template.js @@ -1,5 +1,4 @@ var mock = require('./mock'); -var pkg = require('../package.json'); var Output = require('../lib/output/base'); describe('Template', function() { @@ -19,8 +18,8 @@ describe('Template', function() { }); it('should render with variable', function() { - return output.template.renderString('Version is {{ gitbook.version }}') - .should.be.fulfilledWith('Version is '+pkg.version); + return output.template.renderString('Hello {{ world }}', { world: 'World'}) + .should.be.fulfilledWith('Hello World'); }); }); |