ni_nitdoc: Adding menu in modules page
authorStefan Lage <lagestfan@gmail.com>
Fri, 28 Jun 2013 19:12:25 +0000 (15:12 -0400)
committerStefan Lage <lagestfan@gmail.com>
Wed, 3 Jul 2013 20:54:23 +0000 (16:54 -0400)
Signed-off-by: Stefan Lage <lagestfan@gmail.com>

src/ni_nitdoc.nit

index 29778d8..e63146a 100644 (file)
@@ -462,6 +462,7 @@ class NitdocModules
        redef fun body do
                super
                open("div").add_class("page")
+               menu
                add_content
                close("div")
                add("footer").text("Nit standard library. Version jenkins-component=stdlib-19.")
@@ -489,6 +490,48 @@ class NitdocModules
                close("div")
        end
 
+       fun menu do
+               var mmodule = amodule.mmodule 
+               open("div").add_class("menu")
+               open("nav")
+               add("h3").text("Module Hierarchy").attr("style","cursor: pointer;")
+               if mmodule.in_importation.direct_greaters.length > 0 then
+                       add_html("<h4>All dependencies</h4><ul>")
+                       for m in mmodule.in_importation.direct_greaters do
+                               if m == mmodule or mmodule == m.public_owner then continue
+                               open("li")
+                               add("a").attr("href", "{m.name}.html").text(m.name)
+                               close("li")
+                       end
+                       add_html("</ul>")
+               end     
+               if mmodule.in_importation.greaters.length > 0 then
+                       add_html("<h4>All clients</h4><ul>")
+                       for m in mmodule.in_importation.greaters do
+                               if m == mmodule then continue
+                               open("li")
+                               add("a").attr("href", "{m.name}.html").text(m.name)
+                               close("li")
+                       end
+                       add_html("</ul>")
+               end
+               close("nav")
+               if mmodule.in_nesting.direct_greaters.length > 0 then
+                       open("nav")
+                       add("h3").text("Nested Modules").attr("style","cursor: pointer;")
+                       open("ul")
+                       for m in mmodule.in_nesting.direct_greaters do
+                               open("li")
+                               add("a").attr("href", "{m.name}.html").text(m.name)
+                               close("li")
+                       end
+                       close("ul")
+                       
+                       close("nav")
+               end
+               close("div")
+       end
+
        fun classes do
                open("div").add_class("module")
                open("article").add_class("classes filterable")