+redef class TabbedGroup
+ redef fun render_body do
+ var tabs = new DocTabs("{html_id}.tabs", "")
+ for child in children do
+ if child.is_hidden then continue
+ var title = child.html_toc_title or else child.toc_title or else ""
+ tabs.add_panel new DocTabPanel(child.html_tab_id, title, child)
+ end
+ addn tabs
+ end
+end
+
+redef class PanelGroup
+ redef var html_title = null
+ redef var toc_title is lazy do return title or else ""
+ redef var is_toc_hidden = true
+end
+
+redef class HomeArticle
+ redef var html_title = "Overview"
+
+ # HTML content to display on the home page.
+ #
+ # This attribute is set by the `doc_render` phase who knows the context.
+ var content: nullable String is noinit, writable
+
+ redef fun render_body do
+ var content = self.content
+ if content != null then add content
+ super
+ end
+end
+
+redef class IndexArticle
+ redef var html_title = "Index"
+
+ redef fun render_body do
+ addn "<div class='container-fluid'>"
+ addn " <div class='row'>"
+ render_list("Modules", mmodules)
+ render_list("Classes", mclasses)
+ render_list("Properties", mprops)
+ addn "</div>"
+ addn "</div>"
+ end
+
+ # Displays a list from the content of `mentities`.
+ private fun render_list(title: String, mentities: Array[MEntity]) do
+ if mentities.is_empty then return
+ addn "<div class='col-xs-4'>"
+ addn new Header(3, title)
+ var lst = new UnorderedList
+ for mentity in mentities do
+ if mentity isa MProperty then
+ var tpl = new Template
+ tpl.add mentity.intro.html_link
+ tpl.add " ("
+ tpl.add mentity.intro.mclassdef.mclass.html_link
+ tpl.add ")"
+ lst.add_li new ListItem(tpl)
+ else
+ lst.add_li new ListItem(mentity.html_link)
+ end
+ end
+ addn lst
+ addn "</div>"
+ end
+end
+