Merge: nitdoc: introduce useful services
[nit.git] / src / doc / doc_phases / doc_graphs.nit
index 906a657..1339d09 100644 (file)
@@ -17,6 +17,7 @@ module doc_graphs
 
 import doc_structure
 import doc_poset
+import html_templates::html_model # FIXME maybe this phase should depend on `html_render`
 
 redef class ToolContext
 
@@ -35,12 +36,13 @@ class GraphPhase
 
        redef fun apply do
                if ctx.opt_nodot.value then return
-               for page in doc.pages do
+               for page in doc.pages.values do
                        var article = page.build_graph(self, doc)
                        if article == null then continue
                        # FIXME avoid diff
                        # page.root.add article
-                       page.root.children[1].children.insert(article, 0)
+                       article.parent = page.root.children.first.children[1]
+                       page.root.children.first.children[1].children.insert(article, 0)
                end
        end
 end
@@ -71,7 +73,7 @@ redef class MModulePage
                        end
                end
                op.append("\}\n")
-               return new GraphArticle(mentity, name, op)
+               return new GraphArticle(mentity, name, "Importation Graph", op)
        end
 end
 
@@ -105,7 +107,7 @@ redef class MClassPage
                        end
                end
                op.append("\}\n")
-               return new GraphArticle(mentity, name, op)
+               return new GraphArticle(mentity, name, "Inheritance Graph", op)
        end
 end
 
@@ -119,6 +121,11 @@ class GraphArticle
        # Graph ID (used for outputing file with names).
        var id: String
 
+       # Graph title to display.
+       var graph_title: String
+
        # Dot script of the graph.
        var dot: Text
+
+       redef var is_empty = false
 end