akashacms-breadcrumbs
Advanced tools
Comparing version 0.1.9 to 0.1.10
20
index.js
@@ -31,3 +31,3 @@ /** | ||
var val = akasha.partialSync(config, "breadcrumbs.html.ejs", { | ||
breadcrumbs: breadcrumbTrail(akasha, config.root_docs, arg.fileName) | ||
breadcrumbs: breadcrumbTrail(akasha, config, arg.fileName) | ||
}); | ||
@@ -39,10 +39,6 @@ if (callback) callback(undefined, val); | ||
var crumb = function(entry) { | ||
var thepath = entry.fullpath; | ||
if (path.extname(thepath) !== ".html") { | ||
thepath = thepath.substr(0, thepath.indexOf(path.extname(thepath))); | ||
} | ||
var crumb = function(akasha, entry) { | ||
return { | ||
title: entry.frontmatter.title, | ||
url: thepath.substr(thepath.indexOf('/')) | ||
url: akasha.urlForFile(entry.path) | ||
}; | ||
@@ -56,11 +52,11 @@ } | ||
**/ | ||
var breadcrumbTrail = function(akasha, root_docs, fileName) { | ||
var breadcrumbTrail = function(akasha, config, fileName) { | ||
var breadCrumbData = []; | ||
var fnBase = path.basename(fileName); | ||
var dirname = path.dirname(fileName); | ||
var entry = akasha.getFileEntry(root_docs, fileName); | ||
var entry = akasha.getFileEntry(config.root_docs, fileName); | ||
if (!entry) { | ||
throw new Error('NO FILE FOUND for ' + fileName); | ||
} | ||
breadCrumbData.push(crumb(entry)); | ||
breadCrumbData.push(crumb(akasha, entry)); | ||
@@ -77,6 +73,6 @@ | ||
// util.log('*** trying ' + dirname); | ||
var indx = akasha.findIndexFile(root_docs, dirname); | ||
var indx = akasha.findIndexFile(config, dirname); | ||
if (indx) { | ||
// util.log('got index=' + util.inspect(indx)); | ||
breadCrumbData.unshift(crumb(indx)); | ||
breadCrumbData.unshift(crumb(akasha, indx)); | ||
} | ||
@@ -83,0 +79,0 @@ if (dirname === '.') quitLoop = true; |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"engines": { | ||
@@ -17,0 +17,0 @@ "node": ">=0.10.1" |
4234
73