summaryrefslogtreecommitdiffstats
path: root/lib/template/loader.js
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-04-23 17:10:16 +0200
committerSamy Pesse <samypesse@gmail.com>2016-04-23 17:10:16 +0200
commite1fa977b5b1b3c03790de6e2c21ee39ba55d9555 (patch)
treea1ad4386100b5779ef930845093c14639a3353b5 /lib/template/loader.js
parentce95f316b9ce1eac1e615db3540c4d0f30408d63 (diff)
downloadgitbook-e1fa977b5b1b3c03790de6e2c21ee39ba55d9555.zip
gitbook-e1fa977b5b1b3c03790de6e2c21ee39ba55d9555.tar.gz
gitbook-e1fa977b5b1b3c03790de6e2c21ee39ba55d9555.tar.bz2
Add json encoding utils
Diffstat (limited to 'lib/template/loader.js')
-rw-r--r--lib/template/loader.js42
1 files changed, 0 insertions, 42 deletions
diff --git a/lib/template/loader.js b/lib/template/loader.js
deleted file mode 100644
index 23d179a..0000000
--- a/lib/template/loader.js
+++ /dev/null
@@ -1,42 +0,0 @@
-var nunjucks = require('nunjucks');
-var location = require('../utils/location');
-
-/*
-Simple nunjucks loader which is passing the reponsability to the Output
-*/
-
-var Loader = nunjucks.Loader.extend({
- async: true,
-
- init: function(engine, opts) {
- this.engine = engine;
- this.output = engine.output;
- },
-
- getSource: function(sourceURL, callback) {
- var that = this;
-
- this.output.onGetTemplate(sourceURL)
- .then(function(out) {
- // We disable cache since content is modified (shortcuts, ...)
- out.noCache = true;
-
- // Transform template before runnign it
- out.source = that.engine.interpolate(out.path, out.source);
-
- return out;
- })
- .nodeify(callback);
- },
-
- resolve: function(from, to) {
- return this.output.onResolveTemplate(from, to);
- },
-
- // Handle all files as relative, so that nunjucks pass responsability to 'resolve'
- isRelative: function(filename) {
- return location.isRelative(filename);
- }
-});
-
-module.exports = Loader;