blob: d3f8d314ada39d65f535b543c3ea60d400dcaf87 [file] [log] [blame]
Chirag Shah18b25552012-08-09 13:57:54 -07001<?cs
2
3# walk the children pages and print them nested below the parent
4page: the node to insert a label, link and check for children
5whitespace: Whitespace to insert before any text in the structure, which helps
6 with nesting children on recursion.
7isRoot: treat this node as if it has children and insert a section node.
8
9?><?cs
10def:write_child_nodes(page,whitespace,isRoot) ?>
11<?cs var:whitespace ?>- title: "<?cs var:page.label ?>"
12<?cs var:whitespace ?> path: <?cs var:page.link ?><?cs
13 if:subcount(page.children) || isRoot ?>
14<?cs var:whitespace ?> section: <?cs
15 /if?><?cs
16 each:child = page.children?>
17<?cs var:whitespace ?> - title: "<?cs var:child.label ?>"
18<?cs var:whitespace ?> path: <?cs var:child.link ?><?cs
19 if:subcount(child.children) ?>
20<?cs var:whitespace ?> section:<?cs
21 call:write_child_nodes(child) ?><?cs
22 /if ?><?cs
23 /each ?><?cs
24/def ?><?cs
25
26
27
28# print out the yaml nav starting with the toc entry and using the first item,
29which is generally the package summary as the root element with the rest of the
30pages as children beneath the package summary.
31
32?>
33toc:<?cs each:page = docs.pages?><?cs
34 if:page.type == "package"?><?cs
35 call:write_child_nodes(page,"",1) ?><?cs
36 else?>
37 <?cs
38 call:write_child_nodes(page," ",0) ?><?cs
39 /if?><?cs
40/each ?>