allow template files to be specified as absolute paths (#480)

This commit is contained in:
Jeff Williams 2013-12-01 10:04:47 -08:00
parent c2c163297e
commit 6156d45582
2 changed files with 7 additions and 2 deletions

View File

@ -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);

View File

@ -0,0 +1,4 @@
/*global describe: true, expect: true, it: true, xdescribe: true, xit: true */
xdescribe('jsdoc/template', function() {
// TODO
});