summaryrefslogtreecommitdiffstats
path: root/lib/output
diff options
context:
space:
mode:
Diffstat (limited to 'lib/output')
-rw-r--r--lib/output/helper/resolveFileToURL.js3
-rw-r--r--lib/output/website/createTemplateEngine.js20
2 files changed, 18 insertions, 5 deletions
diff --git a/lib/output/helper/resolveFileToURL.js b/lib/output/helper/resolveFileToURL.js
index 3dba8f7..026b0e5 100644
--- a/lib/output/helper/resolveFileToURL.js
+++ b/lib/output/helper/resolveFileToURL.js
@@ -13,8 +13,7 @@ function resolveFileToURL(output, filePath) {
// Convert /test.png -> test.png
filePath = LocationUtils.toAbsolute(filePath, '', '');
- var pages = output.getPages();
- var page = pages.get(filePath);
+ var page = output.getPage(filePath);
// if file is a page, return correct .html url
if (page) {
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
},