getArticleByPath is now a global function for template instead of a filter

This commit is contained in:
Samy Pessé
2016-05-02 09:38:24 +02:00
parent 63839bb0a7
commit eb46311561
+15 -9
View File
@@ -56,6 +56,21 @@ function createTemplateEngine(output, currentFile) {
context: context,
globals: {
/**
Return an article by its path
@param {String} articlePath
@return {Object|undefined}
*/
getArticleByPath: function(articlePath) {
var article = summary.getByPath(articlePath);
if (!article) return undefined;
return JSONUtils.encodeSummaryArticle(article);
}
},
filters: defaultFilters.merge({
/**
Translate a sentence
@@ -97,15 +112,6 @@ function createTemplateEngine(output, currentFile) {
contentURL: function(filePath) {
return fileToURL(output, filePath);
},
/**
Return an article by its path
*/
getArticleByPath: function(s) {
var article = summary.getByPath(s);
if (!article) return undefined;
return JSONUtils.encodeSummaryArticle(article);
}
}),