From 6156d455826ad2beb51fa20ef60888930e775b5f Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sun, 1 Dec 2013 10:04:47 -0800 Subject: [PATCH] allow template files to be specified as absolute paths (#480) --- lib/jsdoc/template.js | 5 +++-- test/specs/jsdoc/template.js | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 test/specs/jsdoc/template.js diff --git a/lib/jsdoc/template.js b/lib/jsdoc/template.js index 43356617..ade28387 100644 --- a/lib/jsdoc/template.js +++ b/lib/jsdoc/template.js @@ -38,8 +38,7 @@ exports.Template = function(path) { @return {function} Returns template closure. */ exports.Template.prototype.load = function(file) { - var _path = path.join(this.path, file); - return _.template(fs.readFileSync(_path, 'utf8'), null, this.settings); + return _.template(fs.readFileSync(file, 'utf8'), null, this.settings); }; @@ -53,6 +52,8 @@ exports.Template.prototype.load = function(file) { @return {string} Rendered template. */ exports.Template.prototype.partial = function(file, data) { + file = path.resolve(this.path, file); + // load template into cache if (!(file in this.cache)) { this.cache[file] = this.load(file); diff --git a/test/specs/jsdoc/template.js b/test/specs/jsdoc/template.js new file mode 100644 index 00000000..79f31859 --- /dev/null +++ b/test/specs/jsdoc/template.js @@ -0,0 +1,4 @@ +/*global describe: true, expect: true, it: true, xdescribe: true, xit: true */ +xdescribe('jsdoc/template', function() { + // TODO +});