+ private fun display_mpropdef_list(list: Array[MPropDef]) do
+ open("ul")
+ for prop in list do
+ var nprop = mbuilder.mpropdef2npropdef[prop]
+ if prop.is_intro and prop.mproperty.intro_mclassdef.mclass != mclass then
+ open("li").add_class("inherit")
+ add("span").attr("title", "Inherited").text("H")
+ else if prop.is_intro then
+ open("li").add_class("intro")
+ add("span").attr("title", "Introduced").text("I")
+ else
+ open("li").add_class("redef")
+ add("span").attr("title", "Redefined").text("R")
+ end
+ add_html(prop.link(nprop))
+ close("li")
+ end
+ close("ul")
+ end
+
+ fun inheritance_column do
+ var sorted = new Array[MClass]
+ var sorterp = new ComparableSorter[MClass]
+ open("nav")
+ add("h3").text("Inheritance")
+ if mclass.ancestors.length > 1 then
+ sorted = mclass.ancestors.to_a
+ sorterp.sort(sorted)
+ add("h4").text("Superclasses")
+ open("ul")
+ for sup in sorted do
+ if sup == mclass then continue
+ open("li")
+ add("a").attr("href", "{sup.name}.html").text(sup.name)
+ close("li")
+ end
+ close("ul")
+ end
+
+ if mclass.descendants.length <= 1 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 sorted do
+ if sub == mclass then continue
+ open("li")
+ add("a").attr("href", "{sub.name}.html").text(sub.name)
+ close("li")
+ end
+ 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 sorted do
+ if sub == mclass then continue
+ open("li")
+ add("a").attr("href", "{sub.name}.html").text(sub.name)
+ close("li")
+ end
+ close("ul")
+ else
+ add("h4").text("Too much Subclasses to list")
+ end
+ close("nav")
+ end
+
+ fun class_doc do
+ var nclass = mbuilder.mclassdef2nclassdef[mclass.intro]
+ 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
+ add("h1").text(mclass.to_s)
+ open("div").add_class("subtitle")
+ if mclass.visibility is none_visibility then subtitle += "private "
+ subtitle += "{mclass.kind} {mclass.public_owner.namespace(mbuilder)}::{mclass}"
+ add_html(subtitle)
+ close("div")
+ add_html("<div style=\"float: right;\"><a id=\"lblDiffCommit\"></a></div>")
+ # We add the class description
+ open("section").add_class("description")
+ 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>: {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
+ 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("li")
+ end
+ close("ul")
+ close("section")
+ # Insert virtual types if there is almost one
+ 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 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>")
+ close("h3")
+ add_html("<div class=\"info\">formal generic type</div>")
+ close("article")
+ end
+ end
+ close("section")
+ end
+ # constructors
+ 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 sortedc do description(prop)
+ close("section")
+ end
+ # methods
+ 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}: {nmodule.short_comment}</p>")
+ else
+ add_html("<h3 class=\"concern-toplevel\">Methods refined in {mmodule.link(nmodule)}</h3><p class=\"concern-doc\">{mmodule.name}: {nmodule.short_comment}</p>")
+ end
+ end
+ var sortedc = mmethods.to_a
+ sorterprop.sort(sortedc)
+ for prop in sortedc do description(prop)
+ end
+ # 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 imclass in sortedc do
+ var inclass = mbuilder.mclassdef2nclassdef[imclass.intro].as(AStdClassdef)
+ var sortedp = mclass.inherited[imclass].to_a
+ sorterprop.sort(sortedp)
+ open("p")
+ add_html("Defined in {imclass.link(inclass)}: ")
+ for method in sortedp do
+ #TODO link to inherited propdef
+ add_html("<a href=\"\">{method.name}</a>")
+ if method != sortedp.last then add_html(", ")
+ end
+ close("p")
+ end
+ end
+ close("section")
+ end
+
+ fun description(prop: MProperty) do
+ if not mbuilder.mpropdef2npropdef.has_key(prop.intro) then return
+ var nprop = mbuilder.mpropdef2npropdef[prop.intro]
+ if not nprop isa AMethPropdef then return
+ var classes = new Array[String]
+ if nprop isa AInitPropdef then
+ classes.add("init")
+ else
+ classes.add("fun")
+ end
+ if prop.is_redef then classes.add("redef")
+ if prop.visibility == none_visibility then
+ classes.add("private")
+ else if prop.visibility == protected_visibility then
+ classes.add("protected")
+ else
+ classes.add("public")
+ end
+ open("article").add_classes(classes).attr("id", "{prop.anchor}")
+ var sign = prop.name
+ open("h3").add_class("signature")
+ add_html("{prop.name}{nprop.signature}")
+ close("h3")
+ open("div").add_class("info")
+ add_html("{if prop.is_redef then "redef" else ""} fun {prop.intro_mclassdef.namespace(mclass)}::{prop.name}</div><div style=\"float: right;\"><a id=\"lblDiffCommit\"></a>")
+ close("div")
+ open("div").add_class("description")
+ if nprop.comment == "" then
+ add_html("<a class=\"newComment\" title=\"32\" tag=\"\">New Comment</a>")
+ else
+ add_html("<pre class=\"text_label\" title=\"\" name=\"\" tag=\"\" type=\"1\">{nprop.comment}</pre>")
+ end
+ add_html("<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>")
+ open("p")
+ if prop.local_class != mclass then
+ var mredef = prop.local_class.intro_mmodule
+ var nredef = mbuilder.mmodule2nmodule[mredef]
+ add_html("inherited from {mredef.link(nredef)} ")
+ end
+ #TODO display show code if doc github
+ var mintro = prop.intro_mclassdef.mmodule
+ var nintro = mbuilder.mmodule2nmodule[mintro]
+ add_html("defined by the module {mintro.link(nintro)}{if prop.apropdef is null then "" else show_source(prop.apropdef.location)}.")
+
+ for parent in mclass.parents do
+ var mparent = parent.intro_mmodule
+ var nparent = mbuilder.mmodule2nmodule[mparent]
+ if prop isa MMethod then if parent.constructors.has(prop) then add_html(" Previously defined by: {mparent.link(nparent)} for <a href=\"{parent.name}.html\">{parent.name}</a>.")
+ end
+ close("p")
+ close("div")