summaryrefslogtreecommitdiffstats
path: root/lib/template.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/template.js')
-rw-r--r--lib/template.js37
1 files changed, 1 insertions, 36 deletions
diff --git a/lib/template.js b/lib/template.js
index 4b2035f..9f01d3c 100644
--- a/lib/template.js
+++ b/lib/template.js
@@ -4,11 +4,10 @@ var path = require("path");
var nunjucks = require("nunjucks");
var escapeStringRegexp = require("escape-string-regexp");
-var git = require("./utils/git");
-var fs = require("./utils/fs");
var batch = require("./utils/batch");
var pkg = require("../package.json");
var defaultBlocks = require("./blocks");
+var BookLoader = require("./conrefs_loader")
// Normalize result from a block
function normBlockResult(blk) {
@@ -16,40 +15,6 @@ function normBlockResult(blk) {
return blk;
}
-// The loader should handle relative and git url
-var BookLoader = nunjucks.Loader.extend({
- async: true,
-
- init: function(book) {
- this.book = book;
- },
-
- getSource: function(fileurl, callback) {
- var that = this;
-
- git.resolveFile(fileurl)
- .then(function(filepath) {
- // Is local file
- if (!filepath) filepath = that.book.resolve(fileurl);
- else that.book.log.debug.ln("resolve from git", fileurl, "to", filepath)
-
- // Read file from absolute path
- return fs.readFile(filepath)
- .then(function(source) {
- return {
- src: source.toString(),
- path: filepath
- }
- });
- })
- .nodeify(callback);
- },
-
- resolve: function(from, to) {
- return path.resolve(path.dirname(from), to);
- }
-});
-
var TemplateEngine = function(book) {
this.book = book;