Skip to content

Commit

Permalink
Merge pull request #1270 from s-ludwig/module_package_nav
Browse files Browse the repository at this point in the history
Move package.d modules navigation entries into their package menu.
  • Loading branch information
CyberShadow committed Apr 18, 2016
2 parents 04df4e6 + ededd18 commit 6b0b358
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions dpl-docs/views/ddox.inc.module-tree.dt
@@ -1,16 +1,32 @@
- import ddox.entities;

- void moduleNavTree(Package pack)
- Module getPackageModule(Package pack)
- import std.algorithm : find;
- if (auto pp = cast(Package)pack.parent)
- return pp.lookup!Module(pack.name);
- return null;

- void moduleNavTree(Package pack, Module pack_mod)
- string pack_class = "expand-container";
- foreach(i, p; pack.packages)
li(class='#{p.isAncestorOf(info.node) ? pack_class ~ " open" : pack_class}')
- auto subpackmod = getPackageModule(p);
- bool is_active = p.isAncestorOf(info.node) || subpackmod && subpackmod.isAncestorOf(info.node) || subpackmod is info.node;
li(class=is_active ? pack_class ~ " open" : pack_class)
a.package(href="#", class="expand-toggle")
span= p !is info.rootPackage ? p.name : null
ul.tree-view
- moduleNavTree(p);
- moduleNavTree(p, subpackmod);

- if (pack_mod)
li
a.module(href="#{info.linkTo(pack_mod)}", class='#{info.node is pack_mod || pack_mod.isAncestorOf(info.node) ? "selected" : ""}')
span Package members

- foreach(m; pack.modules)
- if (pack.lookup!Package(m.name))
- continue;
li
a.module(href="#{info.linkTo(m)}", class='#{info.node is m || m.isAncestorOf(info.node) ? "selected" : ""}')
span= m.name

- moduleNavTree(info.rootPackage);
- moduleNavTree(info.rootPackage, null);

0 comments on commit 6b0b358

Please sign in to comment.