# A template link to the mentity `nitdoc_id`
fun tpl_anchor: TplLink do
var tpl = new TplLink("#{nitdoc_id}", nitdoc_name)
+ var mdoc = mdoc_or_fallback
if mdoc != null then
tpl.title = mdoc.short_comment
end
# A template link to the mentity `nitdoc_url`
fun tpl_link: TplLink do
var tpl = new TplLink(nitdoc_url, nitdoc_name)
+ var mdoc = mdoc_or_fallback
if mdoc != null then
tpl.title = mdoc.short_comment
end
# A template article that briefly describe the entity
fun tpl_short_article: TplArticle do
var tpl = tpl_article
+ var mdoc = mdoc_or_fallback
if mdoc != null then
tpl.content = mdoc.tpl_short_comment
end
var lnk = new Template
lnk.add new TplLabel.with_classes(tpl_css_classes)
lnk.add tpl_link
+ var mdoc = mdoc_or_fallback
if mdoc != null then
lnk.add ": "
lnk.add mdoc.tpl_short_comment
private fun tpl_concern_item: TplListItem do
var lnk = new Template
lnk.add tpl_anchor
+ var mdoc = mdoc_or_fallback
if mdoc != null then
lnk.add ": "
lnk.add mdoc.tpl_short_comment
redef fun nitdoc_name do return name.html_escape
redef fun nitdoc_url do return root.nitdoc_url
- redef fun mdoc do
- if root != null then
- return root.mdoc
- end
- return super
- end
-
redef fun tpl_declaration do
var tpl = new Template
tpl.add "<span>project "
redef fun tpl_definition do
var tpl = new TplClassDefinition
+ var mdoc = mdoc_or_fallback
if mdoc != null then
tpl.comment = mdoc.tpl_comment
end
redef fun nitdoc_name do return name.html_escape
redef var nitdoc_id = "{intro_mmodule.nitdoc_id}__{name.to_cmangle}" is lazy
redef fun nitdoc_url do return "class_{nitdoc_id}.html"
- redef fun mdoc do return intro.mdoc
+ redef fun mdoc_or_fallback do return intro.mdoc
redef fun tpl_declaration do return intro.tpl_declaration
redef var nitdoc_id = "{mmodule.nitdoc_id}__{name.to_cmangle}" is lazy
redef fun nitdoc_url do return "{mclass.nitdoc_url}#{nitdoc_id}"
+ redef fun mdoc_or_fallback do return mdoc or else mclass.mdoc_or_fallback
+
redef fun tpl_namespace do
var tpl = new Template
tpl.add mmodule.tpl_namespace
title.add "in "
title.add mmodule.tpl_namespace
tpl.subtitle = title
+ var mdoc = mdoc_or_fallback
if mdoc != null then
tpl.content = mdoc.tpl_comment
end
redef fun tpl_definition do
var tpl = new TplClassDefinition
tpl.namespace = tpl_namespace
+ var mdoc = mdoc_or_fallback
if mdoc != null then
tpl.comment = mdoc.tpl_comment
end
end
return tpl
end
-
- redef fun tpl_list_item do
- var lnk = new Template
- lnk.add new TplLabel.with_classes(tpl_css_classes)
- lnk.add tpl_link
- if mdoc != null then
- lnk.add ": "
- lnk.add mdoc.tpl_short_comment
- else if mclass.intro.mdoc != null then
- lnk.add ": "
- lnk.add mclass.intro.mdoc.tpl_short_comment
- end
- return new TplListItem.with_content(lnk)
- end
-
- redef fun tpl_anchor: TplLink do
- var tpl = new TplLink("#{nitdoc_id}", nitdoc_name)
- if mdoc != null then
- tpl.title = mdoc.short_comment
- else if mclass.intro.mdoc != null then
- tpl.title = mclass.intro.mdoc.short_comment
- end
- return tpl
- end
-
- redef fun tpl_link: TplLink do
- var tpl = new TplLink(nitdoc_url, nitdoc_name)
- if mdoc != null then
- tpl.title = mdoc.short_comment
- else if mclass.intro.mdoc != null then
- tpl.title = mclass.intro.mdoc.short_comment
- end
- return tpl
- end
end
redef class MProperty
redef fun nitdoc_name do return name.html_escape
redef fun nitdoc_url do return "property_{nitdoc_id}.html"
- redef fun mdoc do return intro.mdoc
+ redef fun mdoc_or_fallback do return intro.mdoc
redef fun tpl_namespace do
var tpl = new Template
redef var nitdoc_id = "{mclassdef.nitdoc_id}__{name.to_cmangle}" is lazy
redef fun nitdoc_url do return "{mproperty.nitdoc_url}#{nitdoc_id}"
- redef fun tpl_anchor: TplLink do
- var tpl = new TplLink("#{nitdoc_id}", nitdoc_name)
- if mdoc != null then
- tpl.title = mdoc.short_comment
- else if mproperty.intro.mdoc != null then
- tpl.title = mproperty.intro.mdoc.short_comment
- end
- return tpl
- end
-
- redef fun tpl_link: TplLink do
- var tpl = new TplLink(nitdoc_url, nitdoc_name)
- if mdoc != null then
- tpl.title = mdoc.short_comment
- else if mproperty.intro.mdoc != null then
- tpl.title = mproperty.intro.mdoc.short_comment
- end
- return tpl
- end
+ redef fun mdoc_or_fallback do return mdoc or else mproperty.mdoc_or_fallback
redef fun tpl_namespace do
var tpl = new Template
title.add mclassdef.tpl_link
tpl.title = title
tpl.subtitle = tpl_declaration
+ var mdoc = mdoc_or_fallback
if mdoc != null then
tpl.content = mdoc.tpl_comment
end
redef fun tpl_definition do
var tpl = new TplDefinition
tpl.namespace = mclassdef.tpl_namespace
+ var mdoc = mdoc_or_fallback
if mdoc != null then
tpl.comment = mdoc.tpl_comment
end
var anchor = tpl_link
anchor.href = "{mclassdef.mclass.nitdoc_url}#{mproperty.nitdoc_id}"
lnk.add anchor
+ var mdoc = mdoc_or_fallback
if mdoc != null then
lnk.add ": "
lnk.add mdoc.tpl_short_comment
- else if mproperty.intro.mdoc != null then
- lnk.add ": "
- lnk.add mproperty.intro.mdoc.tpl_short_comment
end
return new TplListItem.with_content(lnk)
end
var anchor = mclassdef.tpl_link
anchor.href = "{mclassdef.mclass.nitdoc_url}#{mproperty.nitdoc_id}"
lnk.add anchor
+ var mdoc = mdoc_or_fallback
if mdoc != null then
lnk.add ": "
lnk.add mdoc.tpl_short_comment
redef fun tpl_definition do
var tpl = new TplClassDefinition
tpl.namespace = mclassdef.tpl_namespace
+ var mdoc = mdoc_or_fallback
if mdoc != null then
tpl.comment = mdoc.tpl_comment
end
var article = mproject.tpl_article
article.subtitle = mproject.tpl_declaration
article.content = mproject.tpl_definition
- if mproject.mdoc != null then
- article.content = mproject.mdoc.tpl_short_comment
+ var mdoc = mproject.mdoc_or_fallback
+ if mdoc != null then
+ article.content = mdoc.tpl_short_comment
end
return article
end
article.title_classes.add "signature"
article.summary_title = "{mprop.nitdoc_name}"
article.subtitle = main_mpropdef.tpl_namespace
- if main_mpropdef.mdoc != null then
- article.content = main_mpropdef.mdoc.tpl_comment
+ if main_mpropdef.mdoc_or_fallback != null then
+ article.content = main_mpropdef.mdoc_or_fallback.tpl_comment
end
var subarticle = new TplArticle("{main_mpropdef.nitdoc_id}.redefs")
# Add redef in same `MClass`
redef_article.title_classes.add "signature info"
redef_article.css_classes.add "nospace"
var redef_content = new Template
- if mpropdef.mdoc != null then
- redef_content.add mpropdef.mdoc.tpl_comment
+ if mpropdef.mdoc_or_fallback != null then
+ redef_content.add mpropdef.mdoc_or_fallback.tpl_comment
end
redef_article.content = redef_content
subarticle.add_child redef_article
var cls_url = mprop.intro.mclassdef.mclass.nitdoc_url
var def_url = "{cls_url}#{mprop.nitdoc_id}"
var lnk = new TplLink(def_url, mprop.name)
- if mprop.intro.mdoc != null then lnk.title = mprop.intro.mdoc.short_comment
+ var mdoc = mprop.intro.mdoc_or_fallback
+ if mdoc != null then lnk.title = mdoc.short_comment
var item = new Template
item.add new TplLabel.with_classes(classes)
item.add lnk
var section = new TplSection.with_title("top", tpl_title)
section.subtitle = mclass.intro.tpl_declaration
var article = new TplArticle("comment")
- if mclass.mdoc != null then
- article.content = mclass.mdoc.tpl_comment
+ var mdoc = mclass.mdoc_or_fallback
+ if mdoc != null then
+ article.content = mdoc.tpl_comment
end
section.add_child article
return section