Skip to content

Commit

Permalink
[fix] ToC no longer adds a 'undefined' field
Browse files Browse the repository at this point in the history
  • Loading branch information
jfhbrook committed Oct 20, 2011
1 parent 4dac673 commit 35493c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 11 additions & 1 deletion lib/fs2.js
Expand Up @@ -44,11 +44,21 @@ fs2.filesToTree = function(files){

files = files.reduce(function (acc, file) {
var ps = file.split('/');
ps = ps.filter(function (e) {
var isdot = (e === ".");
var isUndef = (e === "undefined");
if (isUndef) { console.log("undefined from "+file); }
return !isdot && !isUndef;
});

ps.splice(0,1);
traverse(acc).set(ps, {});
return acc;
}, {});


// why is this happening?
delete files.undefined;

return files;

}
Expand Down
3 changes: 2 additions & 1 deletion lib/helpers.js
Expand Up @@ -33,9 +33,10 @@ helpers.buildToc = function (src) {
});

_articles = _articles.map(function (a) {
return helpers.unresolve(src+"/articles", a);
return helpers.unresolve(src, a);
});

// toc has an "undefined" value.
var toc = fs2.filesToTree(_articles);

return helpers.treeToHTML(toc);
Expand Down

0 comments on commit 35493c0

Please sign in to comment.