- redef fun mdoc_or_fallback do return mdoc or else mproperty.mdoc_or_fallback
-
- # Depends if `self` is an intro or not.
- #
- # * If intro contains the visibility and kind.
- # * If redef contains the `redef` keyword and kind.
- redef fun html_modifiers do
- var res = new Array[String]
- if not is_intro then
- res.add "redef"
- else
- if mproperty.visibility != public_visibility then
- res.add mproperty.visibility.to_s
- end
- end
- return res
- end
-
- # Depends if `self` is an intro or not.
- #
- # For intro: `private fun foo(e: Object): Bar is abstract`
- # For redef: `redef fun foo(e) is cached`
- # TODO change the implementation to correspond to the comment.
- redef fun html_declaration do
- var tpl = new Template
- tpl.add "<span>"
- tpl.add html_modifiers.join(" ")
- tpl.add " "
- tpl.add html_link
- tpl.add tpl_signature
- tpl.add "</span>"
- return tpl
- end
-
- redef fun tpl_namespace do
- var tpl = new Template
- tpl.add mclassdef.tpl_namespace
- tpl.add "::"
- tpl.add html_link
- return tpl
- end
-
- redef fun tpl_article do
- var tpl = new TplArticle(nitdoc_id)
- tpl.summary_title = "in {mclassdef.html_name}"
- var title = new Template
- title.add "in "
- title.add mclassdef.html_link
- tpl.title = title
- tpl.subtitle = html_declaration
- var mdoc = mdoc_or_fallback
- if mdoc != null then
- tpl.content = mdoc.tpl_comment
- end
- return tpl
- end
-
- redef fun tpl_definition do
- var tpl = new TplDefinition
- var mdoc = mdoc_or_fallback
- if mdoc != null then
- tpl.comment = mdoc.tpl_comment
- end
- return tpl
- end
-
- redef fun tpl_css_classes do
- var set = new HashSet[String]
- if is_intro then set.add "intro"
- for m in mproperty.intro.modifiers do set.add m.to_cmangle
- for m in modifiers do set.add m.to_cmangle
- return set.to_a
- end
-
- fun tpl_modifiers: Template do
- var tpl = new Template
- for modifier in modifiers do
- if modifier == "public" then continue
- tpl.add "{modifier.html_escape} "
- end
- return tpl
- end
-
- fun tpl_signature: Template do return new Template
-
- redef fun tpl_list_item do
- var lnk = new Template
- lnk.add new TplLabel.with_classes(tpl_css_classes.to_a)
- var atext = html_link.text
- var ahref = "{mclassdef.mclass.nitdoc_url}#{mproperty.nitdoc_id}"
- var atitle = html_link.title
- var anchor = new Link.with_title(ahref, atext, atitle)
- lnk.add anchor
- var mdoc = mdoc_or_fallback
- if mdoc != null then
- lnk.add ": "
- lnk.add mdoc.tpl_short_comment
- end
- return new TplListItem.with_content(lnk)
- end
-
- fun tpl_inheritance_item: TplListItem do
- var lnk = new Template
- lnk.add new TplLabel.with_classes(tpl_css_classes.to_a)
- lnk.add mclassdef.mmodule.tpl_namespace
- lnk.add "::"
- var atext = mclassdef.html_link.text
- var ahref = "{mclassdef.mclass.nitdoc_url}#{mproperty.nitdoc_id}"
- var atitle = mclassdef.html_link.title
- var anchor = new Link.with_title(ahref, atext, atitle)
- lnk.add anchor
- var mdoc = mdoc_or_fallback
- if mdoc != null then
- lnk.add ": "
- lnk.add mdoc.tpl_short_comment
- end
- var li = new TplListItem.with_content(lnk)
- li.css_classes.add "signature"
- return li
- end