+ while d.owner == self do d = d.parent.as(not null)
+ return d.owner
+ end
+
+ # Fill the body for the page associated to the module
+ fun file_page_doc(dctx: DocContext)
+ do
+ dctx.add("<div class=\"menu\">\n")
+
+ var mods = new Array[MMModule]
+ mods = self.mhe.greaters.to_a
+ dctx.sort(mods)
+
+ dctx.open_stage
+ dctx.stage("<nav>\n")
+ dctx.stage("<h3>Module Hierarchy</h3>\n")
+ dctx.stage("<h4>All dependencies</h4>\n")
+ dctx.stage("<ul>\n")
+ for mod in mods do
+ if not mod.require_doc(dctx) then continue
+ if self.mnhe <= mod then continue # do not want nested stuff
+ if mod.direct_owner != null and not mod.direct_owner.mnhe <= self then continue # not in the right nesting
+ dctx.add("<li>{mod.html_link(dctx)}</li>")
+ end
+ dctx.stage("</ul>\n")
+
+ mods = self.mhe.smallers.to_a
+ dctx.sort(mods)
+ dctx.stage("<h4>All clients</h4>\n")
+ dctx.stage("<ul>\n")
+ for mod in mods do
+ if not mod.require_doc(dctx) then continue
+ if self.mnhe <= mod then continue # do not want nested stuff
+ if mod.direct_owner != null and not mod.direct_owner.mnhe <= self then continue # not in the right nesting
+ dctx.add("<li>{mod.html_link(dctx)}</li>")
+ end
+ dctx.stage("</ul>\n")
+ dctx.stage("</nav>\n")
+ dctx.close_stage
+
+ if not dctx.public_only then
+ mods = self.mnhe.direct_greaters.to_a
+ dctx.sort(mods)
+ dctx.open_stage
+ dctx.stage("<nav>\n")
+ dctx.stage("<h3>Nested Modules</h3><ul>\n")
+ for mod in mods do
+ if not mod.require_doc(dctx) then continue
+ dctx.add("<li>{mod.html_link(dctx)}</li>")
+ end
+ dctx.stage("</ul></nav>\n")
+ dctx.close_stage
+ end
+
+ dctx.add("</div>") # metadata
+
+ dctx.add("<div class=\"content\">\n")
+ dctx.add("<h1>{name}</h1>\n")
+ dctx.add("<div class='subtitle'>module ")
+ for m in mnhe.smallers do
+ dctx.add("{m.html_link(dctx)}::")
+ end
+ dctx.add("{self.name}</div>\n")
+ dctx.add("<div style=\"float: right;\"><a id=\"lblDiffCommit\"></a></div>")
+ dctx.add("<section class='description'>\n")
+
+ var doc = doc
+ if doc != null then
+ dctx.add("<div id=\"description\">\n")
+ dctx.add("<pre class=\"text_label\">{doc.to_html}</pre>\n")
+ dctx.add("<textarea rows=\"1\" cols=\"76\" id=\"fileContent\" class=\"edit\"></textarea>\n")
+ dctx.add("<a id=\"cancelBtn\">Cancel</a><a id=\"commitBtn\">Commit</a>")
+ dctx.add("<pre id=\"preSave\" type=\"2\" class=\"text_label\" ></pre>")
+ dctx.add("</div>\n")
+ end
+
+ var op = new Buffer
+ op.append("digraph {name} \{ rankdir=BT; node[shape=none,margin=0,width=0,height=0,fontsize=10]; edge[dir=none,color=gray]; ranksep=0.2; nodesep=0.1;\n")
+ var ms = new Array[nullable MMModule]
+ do
+ var m0: nullable MMModule = self
+ while m0 != null do
+ m0 = m0.direct_owner
+ ms.add(m0)
+ end
+ end
+ var cla = new HashSet[MMModule]
+ cla.add(self)
+ for m0 in self.mhe.greaters do
+ if not m0.require_doc(dctx) then continue
+ if self.visibility_for(m0) <= 1 then continue # private or hidden
+ if self.mnhe <= m0 then continue # do not want nested stuff
+ if m0.direct_owner != null and not m0.direct_owner.mnhe <= self then continue # not in the right nesting
+ cla.add(m0)
+ end
+ for m0 in self.mhe.smallers do
+ if not m0.require_doc(dctx) then continue
+ if m0.visibility_for(self) <= 1 then continue # private or hidden
+ if m0.direct_owner != null and not m0.direct_owner.mnhe <= self then continue # not in the right nesting
+ cla.add(m0)
+ end
+ for m0 in self.mnhe.smallers do
+ cla.add(m0)
+ end
+ ms = ms.reversed
+ for m0 in ms do
+ if m0 != null then
+ op.append("subgraph \"cluster_{m0.name}\"\{\n")
+ end
+ for c in cla do
+ if c.direct_owner != m0 then continue
+ if c == self then
+ op.append("\"{c.name}\"[shape=box,margin=0.03];\n")
+ else
+ op.append("\"{c.name}\"[URL=\"{c.html_name}.html\"];\n")
+ end
+ end
+ if m0 != null then
+ op.append("\"{m0.name}\"[URL=\"{m0.html_name}.html\"];\n")
+ for c in m0.mhe.direct_greaters do
+ if not cla.has(c) then continue
+ op.append("\"{m0.name}\"->\"{c.name}\";\n")
+ end
+ end