diff options
Diffstat (limited to 'lib/output/website/createTemplateEngine.js')
-rw-r--r-- | lib/output/website/createTemplateEngine.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/output/website/createTemplateEngine.js b/lib/output/website/createTemplateEngine.js index 8c31ea7..c60b3a1 100644 --- a/lib/output/website/createTemplateEngine.js +++ b/lib/output/website/createTemplateEngine.js @@ -71,16 +71,29 @@ function createTemplateEngine(output, currentFile) { /** Return an article by its path - @param {String} articlePath + @param {String} filePath @return {Object|undefined} */ - function getArticleByPath(articlePath) { - var article = summary.getByPath(articlePath); + function getArticleByPath(filePath) { + var article = summary.getByPath(filePath); if (!article) return undefined; return JSONUtils.encodeSummaryArticle(article); } + /** + Return a page by its path + + @param {String} filePath + @return {Object|undefined} + */ + function getPageByPath(filePath) { + var page = output.getPage(filePath); + if (!page) return undefined; + + return JSONUtils.encodePage(page, summary); + } + return TemplateEngine.create({ loader: loader, @@ -89,6 +102,7 @@ function createTemplateEngine(output, currentFile) { globals: { getArticleByPath: getArticleByPath, + getPageByPath: getPageByPath, fileExists: fileExists }, |