end
fun overview do
- var overviewpage = new NitdocOverview.with(modelbuilder.nmodules, self.opt_nodot.value, destinationdir.to_s)
+ var overviewpage = new NitdocOverview.with(modelbuilder, self.opt_nodot.value, destinationdir.to_s)
overviewpage.save("{destinationdir.to_s}/index.html")
end
class NitdocOverview
super NitdocPage
- var amodules: Array[AModule]
+ var mbuilder: ModelBuilder
# Init with Array[AModule] to get all ifnormations about each MModule containt in a program
# opt_nodot to inform about the graph gen
# destination: to know where will be saved dot files
- init with(modules: Array[AModule], opt_nodot: Bool, destination: String) do
- self.amodules = modules
+ init with(mbuilder: ModelBuilder, opt_nodot: Bool, destination: String) do
+ self.mbuilder = mbuilder
self.opt_nodot = opt_nodot
self.destinationdir = destination
end
end
fun add_modules do
- var ls = new List[nullable MModule]
- for amodule in amodules do
- var mmodule = amodule.mmodule.public_owner
- if mmodule != null and not ls.has(mmodule) then
- open("li")
- add("a").attr("href", "{mmodule.name}.html").text("{mmodule.to_s} ")
- add_html(amodule.comment)
- close("li")
- ls.add(mmodule)
- end
+ var mmodules = list_mmodules
+ var sorted = new Array[MModule].from(mmodules)
+ var sorter = new ComparableSorter[MModule]
+ sorter.sort(sorted)
+ for mmodule in sorted do
+ var amodule = mbuilder.mmodule2nmodule[mmodule]
+ open("li")
+ add("a").attr("href", "{mmodule.name}.html").text("{mmodule.to_s} ")
+ add_html(amodule.short_comment)
+ close("li")
end
end
fun process_generate_dot do
var op = new Buffer
op.append("digraph dep \{ 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")
- for amodule in amodules do
- op.append("\"{amodule.mmodule.name}\"[URL=\"{amodule.mmodule.name}.html\"];\n")
- for mmodule2 in amodule.mmodule.in_importation.direct_greaters do
- op.append("\"{amodule.mmodule.name}\"->\"{mmodule2.name}\";\n")
+ for mmodule in list_mmodules do
+ op.append("\"{mmodule.name}\"[URL=\"{mmodule.name}.html\"];\n")
+ for imported in mmodule.in_importation.direct_greaters do
+ if imported.direct_owner == null then
+ op.append("\"{mmodule.name}\"->\"{imported.name}\";\n")
+ end
end
end
op.append("\}\n")
generate_dot(op.to_s, "dep", "Modules hierarchy")
end
+ private fun list_mmodules: Set[MModule] do
+ var mmodules = new HashSet[MModule]
+ for mmodule in mbuilder.model.mmodules do
+ var owner = mmodule.public_owner
+ if owner != null then
+ mmodules.add(owner)
+ else
+ mmodules.add(mmodule)
+ end
+ end
+ return mmodules
+ end
+
end
class NitdocFullindex
# Add to content modules column
fun module_column do
var ls = new List[nullable MModule]
+ var sorted = mmodules
+ var sorterp = new ComparableSorter[MModule]
+ sorterp.sort(sorted)
open("article").add_class("modules filterable")
add("h2").text("Modules")
open("ul")
- for mmodule in mmodules do
+ for mmodule in sorted do
if mmodule.public_owner != null and not ls.has(mmodule.public_owner) then
ls.add(mmodule.public_owner)
open("li")
# Add to content classes modules
fun classes_column do
+ var sorted = mmodules.first.imported_mclasses.to_a
+ var sorterp = new ComparableSorter[MClass]
+ sorterp.sort(sorted)
open("article").add_class("classes filterable")
add("h2").text("Classes")
open("ul")
- for mclass in mmodules.first.imported_mclasses do
+ for mclass in sorted do
open("li")
add("a").attr("href", "{mclass.name}.html").text(mclass.name)
close("li")
open("article").add_class("properties filterable")
add("h2").text("Properties")
open("ul")
+ var sorted_imported = mmodules.first.imported_methods.to_a
+ var sorted_redef = mmodules.first.redef_methods.to_a
+ var sorterp = new ComparableSorter[MProperty]
+ sorterp.sort(sorted_imported)
+ sorterp.sort(sorted_redef)
- for method in mmodules.first.imported_methods do
+ for method in sorted_imported do
if method.visibility is none_visibility or method.visibility is intrude_visibility then continue
open("li").add_class("intro")
add("span").attr("title", "introduction").text("I")
close("li")
end
- for method in mmodules.first.redef_methods do
+ for method in sorted_redef do
if method.visibility is none_visibility or method.visibility is intrude_visibility then continue
open("li").add_class("redef")
add("span").attr("title", "redefinition").text("R")
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
+ var sorted = mmodule.in_importation.direct_greaters.to_a
+ var sorterp = new ComparableSorter[MModule]
+ sorterp.sort(sorted)
+ for m in sorted do
if m == mmodule or mmodule == m.public_owner then continue
open("li")
add("a").attr("href", "{m.name}.html").text(m.name)
end
if mmodule.in_importation.greaters.length > 0 then
add_html("<h4>All clients</h4><ul>")
- for m in mmodule.in_importation.greaters do
+ var sorted = mmodule.in_importation.greaters.to_a
+ var sorterp = new ComparableSorter[MModule]
+ sorterp.sort(sorted)
+ for m in sorted do
if m == mmodule then continue
open("li")
add("a").attr("href", "{m.name}.html").text(m.name)
end
close("nav")
if mmodule.in_nesting.direct_greaters.length > 0 then
+ var sorted = mmodule.in_nesting.direct_greaters.to_a
+ var sorterp = new ComparableSorter[MModule]
+ sorterp.sort(sorted)
open("nav")
add("h3").text("Nested Modules").attr("style","cursor: pointer;")
open("ul")
- for m in mmodule.in_nesting.direct_greaters do
+ for m in sorted do
open("li")
add("a").attr("href", "{m.name}.html").text(m.name)
close("li")
end
fun classes do
+ var sorted = new Array[MClass]
+ sorted.add_all(amodule.mmodule.mclasses.keys)
+ var sorterp = new ComparableSorter[MClass]
+ sorterp.sort(sorted)
open("div").add_class("module")
open("article").add_class("classes filterable")
add("h2").text("Classes")
open("ul")
- for c, state in amodule.mmodule.mclasses do
+ for c in sorted do
+ var state = amodule.mmodule.mclasses[c]
var name = c.name
if state == c_is_intro or state == c_is_imported then
open("li").add_class("intro")
end
fun properties do
+ var sorted_imported = amodule.mmodule.imported_methods.to_a
+ var sorted_redef = amodule.mmodule.redef_methods.to_a
+ var sorterp = new ComparableSorter[MProperty]
+ sorterp.sort(sorted_imported)
+ sorterp.sort(sorted_redef)
open("article").add_class("properties filterable")
add_html("<h2>Properties</h2>")
open("ul")
- for method in amodule.mmodule.imported_methods do
+ for method in sorted_imported do
if method.visibility is none_visibility or method.visibility is intrude_visibility then continue
open("li").add_class("intro")
add("span").attr("title", "introduction").text("I")
close("li")
end
- for method in amodule.mmodule.redef_methods do
+ for method in sorted_redef do
if method.visibility is none_visibility or method.visibility is intrude_visibility then continue
open("li").add_class("redef")
add("span").attr("title", "redefinition").text("R")
end
fun properties_column do
+ var sorted = new Array[MProperty]
+ var sorterp = new ComparableSorter[MProperty]
open("nav").add_class("properties filterable")
add("h3").text("Properties")
if mclass.virtual_types.length > 0 then
add("h4").text("Virtual Types")
open("ul")
- for prop in mclass.virtual_types do
+ sorted = mclass.virtual_types.to_a
+ sorterp.sort(sorted)
+ for prop in sorted do
add_html("<li class=\"redef\"><span title=\"Redefined\">R</span><a href=\"{prop.link_anchor}\">{prop.name}</a></li>")
end
close("ul")
end
if mclass.constructors.length > 0 then
+ sorted = mclass.constructors.to_a
+ sorterp.sort(sorted)
add("h4").text("Constructors")
open("ul")
- for prop in mclass.constructors do
+ for prop in sorted do
add_html("<li class=\"intro\"><span title=\"Introduced\">I</span><a href=\"{prop.link_anchor}\">{prop.name}</a></li>")
end
close("ul")
add("h4").text("Methods")
open("ul")
if mclass.intro_methods.length > 0 then
- for prop in mclass.intro_methods do
+ sorted = mclass.intro_methods.to_a
+ sorterp.sort(sorted)
+ for prop in sorted do
if prop.visibility is public_visibility or prop.visibility is protected_visibility then add_html("<li class=\"intro\"><span title=\"Introduced\">I</span><a href=\"{prop.link_anchor}\">{prop.name}</a></li>")
end
end
if mclass.inherited_methods.length > 0 then
- for prop in mclass.inherited_methods do
+ sorted = mclass.inherited_methods.to_a
+ sorterp.sort(sorted)
+ for prop in sorted do
if prop.visibility is public_visibility or prop.visibility is protected_visibility then add_html("<li class=\"inherit\"><span title=\"Inherited\">H</span><a href=\"{prop.link_anchor}\">{prop.name}</a></li>")
end
end
if mclass.redef_methods.length > 0 then
- for prop in mclass.redef_methods do
+ sorted = mclass.redef_methods.to_a
+ sorterp.sort(sorted)
+ for prop in sorted do
if prop.visibility is public_visibility or prop.visibility is protected_visibility then add_html("<li class=\"redef\"><span title=\"Refined\">R</span><a href=\"{prop.link_anchor}\">{prop.name}</a></li>")
end
end
end
fun inheritance_column do
+ var sorted = new Array[MClass]
+ var sorterp = new ComparableSorter[MClass]
open("nav")
add("h3").text("Inheritance")
if mclass.parents.length > 0 then
+ sorted = mclass.parents.to_a
+ sorterp.sort(sorted)
add("h4").text("Superclasses")
open("ul")
- for sup in mclass.parents do add_html("<li><a href=\"{sup.name}.html\">{sup.name}</a></li>")
+ for sup in sorted do add_html("<li><a href=\"{sup.name}.html\">{sup.name}</a></li>")
close("ul")
end
if mclass.descendants.length is 0 then
add("h4").text("No Known Subclasses")
else if mclass.descendants.length <= 100 then
+ sorted = mclass.descendants.to_a
+ sorterp.sort(sorted)
add("h4").text("Subclasses")
open("ul")
- for sub in mclass.descendants do add_html("<li><a href=\"{sub.name}\">{sub.name}</a></li>")
+ for sub in sorted do add_html("<li><a href=\"{sub.name}\">{sub.name}</a></li>")
close("ul")
else if mclass.children.length <= 100 then
+ sorted = mclass.children.to_a
+ sorterp.sort(sorted)
add("h4").text("Direct Subclasses Only")
open("ul")
- for sub in mclass.children do add_html("<li><a href=\"{sub.name}\">{sub.name}</a></li>")
+ for sub in sorted do add_html("<li><a href=\"{sub.name}\">{sub.name}</a></li>")
close("ul")
else
add("h4").text("Too much Subclasses to list")
end
fun content do
+ var sorted = new Array[MModule]
+ sorted.add_all(mclass.concerns.keys)
+ var sorterp = new ComparableSorter[MModule]
+ var sorterprop = new ComparableSorter[MProperty]
+ var sorterc = new ComparableSorter[MClass]
+ sorterp.sort(sorted)
var subtitle = ""
var lmmodule = new List[MModule]
# Insert the subtitle part
open("section").add_class("concerns")
add("h2").add_class("section-header").text("Concerns")
open("ul")
- for owner, childs in mclass.concerns do
+ for owner in sorted do
+ var childs = mclass.concerns[owner]
open("li")
add_html("<a href=\"#MOD_{owner.name}\">{owner.name}</a>: {owner.amodule.short_comment}")
if not childs is null then
open("ul")
- for child in childs.as(not null) do add_html("<li><a href=\"#MOD_{child.name}\">{child.name}</a>: {child.amodule.short_comment} </li>")
+ var sortedc = childs.to_a
+ var sorterpc = new ComparableSorter[MModule]
+ sorterpc.sort(sortedc)
+ for child in sortedc do
+ add_html("<li><a href=\"#MOD_{child.name}\">{child.name}</a>: {child.amodule.short_comment} </li>")
+ end
close("ul")
end
close("li")
end
# Insert constructors if there is almost one
if mclass.constructors.length > 0 then
+ var sortedc = mclass.constructors.to_a
+ sorterprop.sort(sortedc)
open("section").add_class("constructors")
add("h2").add_class("section-header").text("Constructors")
- for prop in mclass.constructors do description(prop)
+ for prop in sortedc do description(prop)
close("section")
end
open("section").add_class("methods")
add_html("<h3 class=\"concern-toplevel\">Methods refined in <a href=\"{mmodule.name}.html\">{mmodule.name}</a></h3><p class=\"concern-doc\">{mmodule.name}: {mmodule.amodule.short_comment}</p>")
end
end
- for prop in mmethods do description(prop)
+ var sortedc = mmethods.to_a
+ sorterprop.sort(sortedc)
+ for prop in sortedc do description(prop)
end
# Insert inherited methods
if mclass.inherited_methods.length > 0 then
+ var sortedc = new Array[MClass]
+ sortedc.add_all(mclass.inherited.keys)
+ sorterc.sort(sortedc)
add("h3").text("Inherited Methods")
- for i_mclass, methods in mclass.inherited do
+ for i_mclass in sortedc do
+ var sortedp = mclass.inherited[i_mclass].to_a
+ sorterprop.sort(sortedp)
open("p")
add_html("Defined in <a href=\"{i_mclass.name}.html\">{i_mclass.name}</a>: ")
- for method in methods do
+ for method in sortedp do
add_html("<a href=\"{method.link_anchor}\">{method.name}</a>")
- if method != methods.last then add_html(", ")
+ if method != sortedp.last then add_html(", ")
end
close("p")
end