core: fix typos in doc of CircularArray
[nit.git] / src / doc / doc_phases / doc_graphs.nit
index 6013088..c559e80 100644 (file)
 # Adds importation and class hierarchy graphs.
 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
 
        # Do not generate `graphviz` diagrams.
-       var opt_nodot = new OptionBool("do not generate graphes with graphviz", "--no-dot")
+       var opt_nodot = new OptionBool("Do not generate graphs with graphviz", "--no-dot")
 
        redef init do
                super
@@ -34,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
@@ -70,7 +73,7 @@ redef class MModulePage
                        end
                end
                op.append("\}\n")
-               return new GraphArticle(name, op)
+               return new GraphArticle("{mentity.nitdoc_id}.graph", "Importation Graph", name, op)
        end
 end
 
@@ -104,7 +107,7 @@ redef class MClassPage
                        end
                end
                op.append("\}\n")
-               return new GraphArticle(name, op)
+               return new GraphArticle("{mentity.nitdoc_id}.graph", "Inheritance Graph", name, op)
        end
 end
 
@@ -113,11 +116,14 @@ end
 # The graph is stored in dot format.
 # The final output is delayed untill rendering.
 class GraphArticle
-       super DocComposite
+       super DocArticle
 
        # Graph ID (used for outputing file with names).
-       var id: String
+       var graph_id: String
 
        # Dot script of the graph.
        var dot: Text
+
+       redef var is_hidden = false
+       redef var is_toc_hidden = true
 end