- # A human-readable hyper-text for the entity
- fun linkto: HTMLTag is abstract
-end
-
-redef class MDoc
- # Append an entry for the doc in the given infobox
- fun fill_infobox(res: HInfoBox)
- do
- if content.length < 2 then
- res.new_field("doc").text(content.first)
- return
- end
- var c = res.new_dropdown("doc", content.first)
- for x in content.iterator.skip_head(1) do
- c.append x
- c.add_raw_html "<br>"
- end
- end
-end
-
-redef class MEntity
- super HInfoBoxable
-end
-
-redef class MModule
- redef fun infobox(v)
- do
- var res = new HInfoBox(v, "module {name}")
- res.href = href
- res.new_field("module").add(linkto)
- var mdoc = self.mdoc
- if mdoc != null then mdoc.fill_infobox(res)
- if in_importation.greaters.length > 1 then
- var c = res.new_dropdown("imports", "{in_importation.greaters.length-1} modules")
- for x in in_importation.greaters do
- if x == self then continue
- c.open("li").add x.linkto
- end
- end
- return res
- end
-
- # The module HTML page
- fun href: String
- do
- return c_name + ".html"
- end
-
- redef fun linkto do return linkto_text(name)
-
- # Link to the entitiy with a specific text
- fun linkto_text(text: String): HTMLTag
- do
- return (new HTMLTag("a")).attr("href", href).text(text)
- end
-end
-
-redef class MClassDef
- redef fun infobox(v)
- do
- var res = new HInfoBox(v, "class {mclass.name}")
- res.href = href
- if is_intro then
- res.new_field("class").text(mclass.name)
- else
- res.new_field("redef class").text(mclass.name)
- res.new_field("intro").add mclass.intro.linkto_text("in {mclass.intro_mmodule.to_s}")
- end
- var mdoc = self.mdoc
- if mdoc == null then mdoc = mclass.intro.mdoc
- if mdoc != null then mdoc.fill_infobox(res)
-
- if in_hierarchy == null then return res
-
- if in_hierarchy.greaters.length > 1 then
- var c = res.new_dropdown("hier", "super-classes")
- for x in in_hierarchy.greaters do
- if x == self then continue
- if not x.is_intro then continue
- c.open("li").add x.linkto
- end
- end
- if in_hierarchy.smallers.length > 1 then
- var c = res.new_dropdown("hier", "sub-classes")
- for x in in_hierarchy.smallers do
- if x == self then continue
- if not x.is_intro then continue
- c.open("li").add x.linkto
- end
- end
- if mclass.mclassdefs.length > 1 then
- var c = res.new_dropdown("redefs", "refinements")
- for x in mclass.mclassdefs do
- if x == self then continue
- c.open("li").add x.linkto_text("in {x.mmodule}")
- end
- end
- return res
- end
-
- # The class HTML page (an anchor in the module page)
- fun href: String
- do
- return mmodule.href + "#" + to_s
- end
-
- redef fun linkto do return linkto_text(mclass.name)
-
- # Link to the entitiy with a specific text
- fun linkto_text(text: String): HTMLTag
- do
- return (new HTMLTag("a")).attr("href", href).text(text)
- end
-end
-
-redef class MPropDef
- redef fun infobox(v)
- do
- var res = new HInfoBox(v, to_s)
- res.href = href
- if self isa MMethodDef then
- if msignature != null then res.new_field("fun").append(mproperty.name).add msignature.linkto
- else if self isa MAttributeDef then
- if static_mtype != null then res.new_field("fun").append(mproperty.name).add static_mtype.linkto
- else if self isa MVirtualTypeDef then
- if bound != null then res.new_field("add").append(mproperty.name).add bound.linkto
- else
- res.new_field("wat?").append(mproperty.name)
- end
-
- if is_intro then
- else
- res.new_field("intro").add mproperty.intro.linkto_text("in {mproperty.intro.mclassdef}")
- end
- var mdoc = self.mdoc
- if mdoc == null then mdoc = mproperty.intro.mdoc
- if mdoc != null then mdoc.fill_infobox(res)
- if mproperty.mpropdefs.length > 1 then
- var c = res.new_dropdown("redef", "redefinitions")
- for x in mproperty.mpropdefs do
- c.open("li").add x.linkto_text("in {x.mclassdef}")
- end
- end
-
- return res
- end
-
- # The property HTML page (an anchor in the module page)
- fun href: String