- # FIXME hideous hacks...
- if mentity isa MModule then
- article = mentity.tpl_article
- article.subtitle = mentity.tpl_declaration
- article.content = mentity.tpl_definition
- else if mentity isa MClass then
- article = make_mclass_article(v, page)
- else if mentity isa MClassDef then
- article = make_mclassdef_article(v, page)
- article.source_link = v.tpl_showsource(mentity.location)
- else if mentity isa MPropDef and page.mentity isa MClass then
- article = make_mpropdef_article(v, doc, page)
- else
- article = mentity.tpl_article
- article.subtitle = mentity.tpl_declaration
- if mentity isa MPropDef then
- article.source_link = v.tpl_showsource(mentity.location)
- end
- if not mentity isa MVirtualTypeProp then
- # article.content = mentity.tpl_comment
- end
- end
- for child in children do
- child.render(v, doc, page, article)
- end
- parent.add_child article
- end
-
- # FIXME avoid diff while preserving TplArticle compatibility.
-
- private fun make_mclass_article(v: RenderHTMLPhase, page: MEntityPage): TplArticle do
- var article = mentity.tpl_article
- article.subtitle = mentity.tpl_namespace
- article.content = null
- return article
- end
-
- private fun make_mclassdef_article(v: RenderHTMLPhase, page: MEntityPage): TplArticle do
- var mclassdef = mentity.as(MClassDef)
- var article = mentity.tpl_article
- if mclassdef.is_intro and mclassdef.mmodule != page.mentity then
- article = mentity.tpl_short_article
- end
- var title = new Template
- title.add "in "
- title.add mclassdef.mmodule.tpl_namespace
- article.subtitle = title
- return article
- end
-
- private fun make_mpropdef_article(v: RenderHTMLPhase, doc: DocModel, page: MEntityPage): TplArticle
- do
- var mpropdef = mentity.as(MPropDef)
- var mprop = mpropdef.mproperty
- var article = new TplArticle(mprop.nitdoc_id)
- var title = new Template
- title.add mprop.tpl_icon
- title.add "<span id='{mpropdef.nitdoc_id}'></span>"
- if mpropdef.is_intro then
- title.add mprop.html_link
- title.add mprop.intro.tpl_signature
- else
- var cls_url = mprop.intro.mclassdef.mclass.nitdoc_url
- var def_url = "{cls_url}#{mprop.nitdoc_id}"
- var lnk = new TplLink.with_title(def_url, mprop.html_name,
- "Go to introduction")
- title.add "redef "
- title.add lnk
- end
- article.title = title
- article.title_classes.add "signature"
- article.summary_title = "{mprop.html_name}"
- article.subtitle = mpropdef.tpl_namespace
- if mpropdef.mdoc_or_fallback != null then
- article.content = mpropdef.mdoc_or_fallback.tpl_comment
- end
- # TODO move in its own phase? let's see after doc_template refactoring.
- # Add linearization
- var all_defs = new HashSet[MPropDef]
- for local_def in local_defs(page.as(MClassPage), mprop) do
- all_defs.add local_def
- var smpropdef = local_def
- while not smpropdef.is_intro do
- smpropdef = smpropdef.lookup_next_definition(
- doc.mainmodule, smpropdef.mclassdef.bound_mtype)
- all_defs.add smpropdef