summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/template.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/template.js b/lib/template.js
index b1bc632..65f24c5 100644
--- a/lib/template.js
+++ b/lib/template.js
@@ -31,7 +31,7 @@ var BookLoader = nunjucks.Loader.extend({
.then(function(filepath) {
// Is local file
if (!filepath) filepath = path.resolve(fileurl);
- else that.book.log.debug.ln("resolve from git", fileurl, "to", filepath)
+ else that.book.log.debug.ln("resolve from git", fileurl, "to", filepath);
// Read file from absolute path
return fs.readFile(filepath)
@@ -53,6 +53,12 @@ var BookLoader = nunjucks.Loader.extend({
// If origin is not in the book (include from a git content ref)
return path.resolve(path.dirname(from), to);
+ },
+
+ // Handle all files as relative, so that nunjucks pass responsability to "resolve"
+ // Only git urls are considered as absolute
+ isRelative: function(filename) {
+ return !git.checkUrl(filename);
}
});