summaryrefslogtreecommitdiffstats
path: root/lib/templating/themesLoader.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-06-10 17:45:30 +0200
committerSamy Pessé <samypesse@gmail.com>2016-06-10 17:45:30 +0200
commit9c927dcf1377e9f4caa3ed234a9fb5b472ecee50 (patch)
treed2ca8a49d8d365578bdb4e6506ce1f88e9ce068e /lib/templating/themesLoader.js
parent7a08b3f109d104903406a38cfd33aa642d30211f (diff)
downloadgitbook-9c927dcf1377e9f4caa3ed234a9fb5b472ecee50.zip
gitbook-9c927dcf1377e9f4caa3ed234a9fb5b472ecee50.tar.gz
gitbook-9c927dcf1377e9f4caa3ed234a9fb5b472ecee50.tar.bz2
Fix #1374 and #1360: apply transform of conrefsLoader using a string, not a buffer
Diffstat (limited to 'lib/templating/themesLoader.js')
-rw-r--r--lib/templating/themesLoader.js50
1 files changed, 25 insertions, 25 deletions
diff --git a/lib/templating/themesLoader.js b/lib/templating/themesLoader.js
index 69c3879..bae4c12 100644
--- a/lib/templating/themesLoader.js
+++ b/lib/templating/themesLoader.js
@@ -12,11 +12,11 @@ var ThemesLoader = nunjucks.Loader.extend({
.map(path.normalize);
},
- /*
- Read source of a resolved filepath
- @param {String}
- @return {Object}
- */
+ /**
+ * Read source of a resolved filepath
+ * @param {String}
+ * @return {Object}
+ */
getSource: function(fullpath) {
if (!fullpath) return null;
@@ -40,19 +40,19 @@ var ThemesLoader = nunjucks.Loader.extend({
};
},
- /*
- Nunjucks calls "isRelative" to determine when to call "resolve".
- We handle absolute paths ourselves in ".resolve" so we always return true
- */
+ /**
+ * Nunjucks calls "isRelative" to determine when to call "resolve".
+ * We handle absolute paths ourselves in ".resolve" so we always return true
+ */
isRelative: function() {
return true;
},
- /*
- Get original search path containing a template
- @param {String} filepath
- @return {String} searchPath
- */
+ /**
+ * Get original search path containing a template
+ * @param {String} filepath
+ * @return {String} searchPath
+ */
getSearchPath: function(filepath) {
return this.searchPaths
.sortBy(function(s) {
@@ -63,22 +63,22 @@ var ThemesLoader = nunjucks.Loader.extend({
});
},
- /*
- Get template name from a filepath
- @param {String} filepath
- @return {String} name
- */
+ /**
+ * Get template name from a filepath
+ * @param {String} filepath
+ * @return {String} name
+ */
getTemplateName: function(filepath) {
var originalSearchPath = this.getSearchPath(filepath);
return originalSearchPath? path.relative(originalSearchPath, filepath) : null;
},
- /*
- Resolve a template from a current template
- @param {String|null} from
- @param {String} to
- @return {String|null}
- */
+ /**
+ * Resolve a template from a current template
+ * @param {String|null} from
+ * @param {String} to
+ * @return {String|null}
+ */
resolve: function(from, to) {
var searchPaths = this.searchPaths;