Skip to content

Commit

Permalink
update references for heading nodes too in layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilad Gray committed Mar 2, 2017
1 parent 4b519b1 commit 6f26f12
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions gulp/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@ module.exports = (blueprint, gulp, plugins) => {
const contents = docs.documentGlobs("packages/core/src/**/*");

function nestChildPage(child, parent) {
const originalRef = child.reference;

// update entry reference to include parent reference
const nestedRef = dm.slugify(parent.reference, originalRef);
child.reference = nestedRef;

if (dm.isPageNode(child)) {
const nestedRef = dm.slugify(parent.reference, child.reference);
// rename nested pages to be <parent>.<child> and remove old <child> entry
contents.docs[nestedRef] = contents.docs[child.reference];
contents.docs[nestedRef] = contents.docs[originalRef];
contents.docs[nestedRef].reference = nestedRef;
delete contents.docs[child.reference];
child.reference = nestedRef;

delete contents.docs[originalRef];
// recurse through page children
child.children.forEach((innerchild) => nestChildPage(innerchild, child));
}
}
Expand Down

0 comments on commit 6f26f12

Please sign in to comment.