end
fun modules do
- for mod in modelbuilder.nmodules do
- var modulepage = new NitdocModules.with(mod)
- modulepage.save("{destinationdir.to_s}/{mod.mmodule.name}.html")
+ for mmodule in model.mmodules do
+ var modulepage = new NitdocModules.with(mmodule, modelbuilder)
+ modulepage.save("{destinationdir.to_s}/{mmodule.name}.html")
end
end
fun classes do
- for amodule in modelbuilder.nmodules do
- for mclass, aclassdef in amodule.mclass2nclassdef do
- mclass.amodule(modelbuilder.mmodule2nmodule)
- mclass.mmethod(aclassdef.mprop2npropdef)
- var classpage = new NitdocMClasses.with(mclass, aclassdef, source)
- classpage.save("{destinationdir.to_s}/{mclass.name}.html")
- end
+ for mclass in modelbuilder.model.mclasses do
+ var classpage = new NitdocMClasses.with(mclass, modelbuilder, source)
+ classpage.save("{destinationdir.to_s}/{mclass.name}.html")
end
end
class NitdocModules
super NitdocPage
- var amodule: AModule
- var modulename: String
- init with(amodule: AModule) do
- self.amodule = amodule
- self.modulename = self.amodule.mmodule.name
+ var mmodule: MModule
+ var mbuilder: ModelBuilder
+
+ init with(mmodule: MModule, mbuilder: ModelBuilder) do
+ self.mmodule = mmodule
+ self.mbuilder = mbuilder
opt_nodot = false
destinationdir = ""
end
redef fun head do
super
- add("title").text("{modulename} module | {amodule.short_comment}")
+ var amodule = mbuilder.mmodule2nmodule[mmodule]
+ add("title").text("{mmodule.name} module | {amodule.short_comment}")
end
redef fun header do
open("li")
add_html("<a href=\"index.html\">Overview</a>")
close("li")
- add("li").add_class("current").text(modulename)
+ add("li").add_class("current").text(mmodule.name)
open("li")
add_html("<a href=\"full-index.html\" >Full Index</a>")
close("li")
# Insert all tags in content part
fun add_content do
open("div").add_class("content")
- add("h1").text(modulename)
- add("div").add_class("subtitle").text("module {modulename}")
+ add("h1").text(mmodule.name)
+ add("div").add_class("subtitle").text("module {mmodule.name}")
module_comment
classes
properties
# Insert module comment in the content
fun module_comment do
+ var amodule = mbuilder.mmodule2nmodule[mmodule]
var doc = amodule.comment
open("div").attr("id", "description")
add("pre").add_class("text_label").text(doc)
end
fun menu do
- var mmodule = amodule.mmodule
+ var amodule = mbuilder.mmodule2nmodule[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
+ if mmodule.in_importation.greaters.length > 0 then
add_html("<h4>All dependencies</h4><ul>")
- var sorted = mmodule.in_importation.direct_greaters.to_a
- var sorterp = new ComparableSorter[MModule]
- sorterp.sort(sorted)
+ var sorted = mmodule.in_importation.greaters.to_a
+ var sorter = new ComparableSorter[MModule]
+ sorter.sort(sorted)
for m in sorted do
- if m == mmodule or mmodule == m.public_owner then continue
+ if m == mmodule or m.public_owner != null 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
+ end
+ if mmodule.in_importation.smallers.length > 0 then
add_html("<h4>All clients</h4><ul>")
- var sorted = mmodule.in_importation.greaters.to_a
- var sorterp = new ComparableSorter[MModule]
- sorterp.sort(sorted)
+ var sorted = mmodule.in_importation.smallers.to_a
+ var sorter = new ComparableSorter[MModule]
+ sorter.sort(sorted)
for m in sorted do
- if m == mmodule then continue
+ if m == mmodule or m.public_owner != null then continue
open("li")
add("a").attr("href", "{m.name}.html").text(m.name)
close("li")
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)
+ var sorter = new ComparableSorter[MModule]
+ sorter.sort(sorted)
open("nav")
add("h3").text("Nested Modules").attr("style","cursor: pointer;")
open("ul")
close("li")
end
close("ul")
-
+
close("nav")
end
close("div")
end
fun classes do
+ var amodule = mbuilder.mmodule2nmodule[mmodule]
+ var intro_mclasses = mmodule.intro_mclasses
+ var redef_mclasses = mmodule.redef_mclasses
+ var all_mclasses = new HashSet[MClass]
+ for m in mmodule.in_nesting.greaters do
+ all_mclasses.add_all(m.intro_mclasses)
+ all_mclasses.add_all(m.redef_mclasses)
+ end
+ all_mclasses.add_all(intro_mclasses)
+ all_mclasses.add_all(redef_mclasses)
+
var sorted = new Array[MClass]
- sorted.add_all(amodule.mmodule.mclasses.keys)
- var sorterp = new ComparableSorter[MClass]
- sorterp.sort(sorted)
+ sorted.add_all(all_mclasses)
+ var sorter = new ComparableSorter[MClass]
+ sorter.sort(sorted)
open("div").add_class("module")
open("article").add_class("classes filterable")
add("h2").text("Classes")
open("ul")
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")
- add("span").attr("title", "introduced in this module").text("I ")
- else
+ if redef_mclasses.has(c) and c.intro_mmodule.public_owner != mmodule then
open("li").add_class("redef")
add("span").attr("title", "refined in this module").text("R ")
+ else
+ open("li").add_class("intro")
+ add("span").attr("title", "introduced in this module").text("I ")
end
add("a").attr("href", "{name}.html").text(name)
close("li")
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)
+ var amodule = mbuilder.mmodule2nmodule[mmodule]
+ var mpropdefs = new HashSet[MPropDef]
+ for m in mmodule.in_nesting.greaters do
+ for c in m.mclassdefs do mpropdefs.add_all(c.mpropdefs)
+ end
+ for c in mmodule.mclassdefs do mpropdefs.add_all(c.mpropdefs)
+ var sorted = mpropdefs.to_a
+ var sorter = new ComparableSorter[MPropDef]
+ sorter.sort(sorted)
open("article").add_class("properties filterable")
add_html("<h2>Properties</h2>")
open("ul")
- 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")
- add_html(" ")
- add("a").attr("href", "{method.local_class.name}.html").attr("title", "").text("{method.name} ({method.local_class.name})")
- close("li")
- end
-
- 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")
+ for p in sorted do
+ if p.mproperty.visibility <= none_visibility then continue
+ if p.is_intro then
+ open("li").add_class("intro")
+ add("span").attr("title", "introduction").text("I")
+ else
+ open("li").add_class("redef")
+ add("span").attr("title", "redefinition").text("R")
+ end
add_html(" ")
- add("a").attr("href", "{method.local_class.name}.html").attr("title", "").text("{method.name} ({method.local_class.name})")
+ add("a").attr("href", "{p.mclassdef.mclass.name}.html").attr("title", "").text("{p.mproperty.name} ({p.mclassdef.mclass.name})")
close("li")
end
-
close("ul")
close("article")
end
-
end
# Nit Standard Library
super NitdocPage
var mclass: MClass
- var aclassdef: AClassdef
- var stdclassdef: nullable AStdClassdef
- var public_owner: nullable MModule
+ var mbuilder: ModelBuilder
- init with(mclass: MClass, aclassdef: AClassdef, source: nullable String) do
+ init with(mclass: MClass, mbuilder: ModelBuilder, source: nullable String) do
self.mclass = mclass
- self.aclassdef = aclassdef
- if aclassdef isa AStdClassdef then self.stdclassdef = aclassdef
- self.public_owner = mclass.intro_mmodule.public_owner
- opt_nodot = false
- destinationdir = ""
+ self.mbuilder = mbuilder
+ self.opt_nodot = false
+ self.destinationdir = ""
self.source = source
end
redef fun head do
super
- add("title").text("{self.mclass.name} class | Nit Standard Library")
+ var nclass = mbuilder.mclassdef2nclassdef[mclass.intro]
+ if nclass isa AStdClassdef then
+ add("title").text("{mclass.name} class | {nclass.short_comment}")
+ else
+ add("title").text("{mclass.name} class")
+ end
end
redef fun header do
add_html("<a href=\"index.html\">Overview</a>")
close("li")
open("li")
+ var public_owner = mclass.public_owner
if public_owner is null then
add_html("<a href=\"{mclass.intro_mmodule.name}.html\">{mclass.intro_mmodule.name}</a>")
else
end
fun content do
+ var nclass = mbuilder.mclassdef2nclassdef[mclass.intro]
var sorted = new Array[MModule]
sorted.add_all(mclass.concerns.keys)
var sorterp = new ComparableSorter[MModule]
add_html("<div style=\"float: right;\"><a id=\"lblDiffCommit\"></a></div>")
# We add the class description
open("section").add_class("description")
- if not stdclassdef is null and not stdclassdef.comment.is_empty then add_html("<pre class=\"text_label\" title=\"122\" name=\"\" tag=\"{mclass.mclassdefs.first.location.to_s}\" type=\"2\">{stdclassdef.comment} </pre><textarea id=\"fileContent\" class=\"edit\" cols=\"76\" rows=\"1\" style=\"display: none;\"></textarea><a id=\"cancelBtn\" style=\"display: none;\">Cancel</a><a id=\"commitBtn\" style=\"display: none;\">Commit</a><pre id=\"preSave\" class=\"text_label\" type=\"2\"></pre>")
+ if nclass isa AStdClassdef and not nclass.comment.is_empty then add_html("<pre class=\"text_label\" title=\"122\" name=\"\" tag=\"{mclass.mclassdefs.first.location.to_s}\" type=\"2\">{nclass.comment} </pre><textarea id=\"fileContent\" class=\"edit\" cols=\"76\" rows=\"1\" style=\"display: none;\"></textarea><a id=\"cancelBtn\" style=\"display: none;\">Cancel</a><a id=\"commitBtn\" style=\"display: none;\">Commit</a><pre id=\"preSave\" class=\"text_label\" type=\"2\"></pre>")
close("section")
open("section").add_class("concerns")
add("h2").add_class("section-header").text("Concerns")
open("ul")
for owner in sorted do
+ var nmodule = mbuilder.mmodule2nmodule[owner]
var childs = mclass.concerns[owner]
open("li")
- add_html("<a href=\"#MOD_{owner.name}\">{owner.name}</a>: {owner.amodule.short_comment}")
+ add_html("<a href=\"#MOD_{owner.name}\">{owner.name}</a>: {nmodule.short_comment}")
if not childs is null then
open("ul")
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>")
+ var nchild = mbuilder.mmodule2nmodule[child]
+ add_html("<li><a href=\"#MOD_{child.name}\">{child.name}</a>: {nchild.short_comment} </li>")
end
close("ul")
end
close("ul")
close("section")
# Insert virtual types if there is almost one
- if mclass.virtual_types.length > 0 or (stdclassdef != null and stdclassdef.n_formaldefs.length > 0) then
+ if mclass.virtual_types.length > 0 or mclass.arity > 0 then
open("section").add_class("types")
add("h2").text("Formal and Virtual Types")
if mclass.virtual_types.length > 0 then for prop in mclass.virtual_types do description(prop)
- if stdclassdef.n_formaldefs.length > 0 then
- for prop in stdclassdef.n_formaldefs do
+ if mclass.arity > 0 and nclass isa AStdClassdef then
+ for prop in nclass.n_formaldefs do
open("article").attr("id", "FT_Object_{prop.collect_text}")
open("h3").add_class("signature").text("{prop.collect_text}: nullable ")
add_html("<a title=\"The root of the class hierarchy.\" href=\"Object.html\">Object</a>")
open("section").add_class("methods")
add("h2").add_class("section-header").text("Methods")
for mmodule, mmethods in mclass.all_methods do
+ var nmodule = mbuilder.mmodule2nmodule[mmodule]
add_html("<a id=\"MOD_{mmodule.name}\"></a>")
if mmodule != mclass.intro_mmodule and mmodule != mclass.public_owner then
if mclass.has_mmodule(mmodule) then
- add_html("<p class=\"concern-doc\">{mmodule.name}: {mmodule.amodule.short_comment}</p>")
+ add_html("<p class=\"concern-doc\">{mmodule.name}: {nmodule.short_comment}</p>")
else
- 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>")
+ add_html("<h3 class=\"concern-toplevel\">Methods refined in <a href=\"{mmodule.name}.html\">{mmodule.name}</a></h3><p class=\"concern-doc\">{mmodule.name}: {nmodule.short_comment}</p>")
end
end
var sortedc = mmethods.to_a
if n_moduledecl is null or n_moduledecl.n_doc is null then ret
if n_moduledecl.n_doc is null then return ""
for t in n_moduledecl.n_doc.n_comment do
- ret += "{t.text.replace("# ", "")}"
+ var txt = t.text
+ txt = txt.replace("# ", "")
+ txt = txt.replace("#", "")
+ ret += txt
end
return ret
end
return methods
end
end
+redef class MPropDef
+ super Comparable
+ redef type OTHER: MPropDef
+ redef fun <(other: OTHER): Bool do return self.mproperty.name < other.mproperty.name
+end
redef class MProperty