Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1270 from s-ludwig/module_package_nav
Move package.d modules navigation entries into their package menu.
- Loading branch information
Showing
1 changed file
with
20 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |