Navigation Menu

Skip to content

Commit

Permalink
Show path to the document entry
Browse files Browse the repository at this point in the history
  • Loading branch information
darashi committed Aug 9, 2012
1 parent 54bb4aa commit 8bdfef0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/convert.js
Expand Up @@ -30,6 +30,7 @@ function parse(doc, context) {
title = doc.textRaw;
context = context || {};
context.items = context.items || [];
context.path = context.path || [];

if (title) {
context.title = title;
Expand All @@ -38,16 +39,21 @@ function parse(doc, context) {
if (doc.desc) {
item.desc = doc.desc;
item.title = context.title;
item.path = context.path.map(function(item) {
return item.title;
}).join(' \xbb ');
context.items.push(item);
}

context.path.push(item);
for (var section in doc) {
if (doc[section] instanceof Array) {
doc[section].forEach(function(subdoc) {
parse(subdoc, context);
});
}
}
context.path.pop(item);

return context.items;
}
Expand Down
1 change: 1 addition & 0 deletions views/search.jade
Expand Up @@ -5,4 +5,5 @@ block content
each record, index in records
.record
h2 #{record.data.title}
p= record.data.path
!{record.data.desc}

0 comments on commit 8bdfef0

Please sign in to comment.