import doc_phases::doc_hierarchies
import doc_phases::doc_graphs
import doc_phases::doc_intros_redefs
+import doc_phases::doc_lin
# Renders the page as HTML.
redef class DocPage
end
lst.add_li new ListItem(content)
end
+
+ # ID used in HTML tab labels.
+ #
+ # We sanitize it for Boostrap JS panels that do not like ":" and "." in ids.
+ var html_tab_id: String is lazy do
+ var id = html_id.replace(":", "")
+ id = id.replace(".", "")
+ return "{id}-tab"
+ end
end
redef class DocSection
end
end
+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
+ tabs.add_panel new DocTabPanel(child.html_tab_id, child.toc_title, child)
+ end
+ addn tabs
+ end
+end
+
+redef class PanelGroup
+ redef var html_id is lazy do return "group:{group_title.to_lower.to_snake_case}"
+ redef var html_title = null
+ redef var toc_title is lazy do return group_title
+ redef var is_toc_hidden = true
+end
+
redef class HomeArticle
- redef var html_id = "intro"
+ redef var html_id = "article:home"
redef var html_title = "Overview"
# HTML content to display on the home page.
end
redef class IndexArticle
- redef var html_id = "index"
+ redef var html_id = "article:index"
redef var html_title = "Index"
redef fun is_empty do
return mmodules.is_empty and mclasses.is_empty and mprops.is_empty
end
redef class ProjectsSection
- redef var html_id = "projects"
+ redef var html_id = "section:projects"
redef var html_title = "Projects"
end
end
redef class MEntitySection
- redef var html_id is lazy do return "section_{mentity.nitdoc_name}"
+ redef var html_id is lazy do return "section:{mentity.nitdoc_name}"
redef var html_title is lazy do return mentity.html_name
redef var html_subtitle is lazy do return mentity.html_declaration
end
redef class ConcernSection
- redef var html_id is lazy do return "section_concerns_{mentity.nitdoc_id}"
+ redef var html_id is lazy do return "concern:{mentity.nitdoc_id}"
redef var html_title is lazy do return "in {mentity.nitdoc_name}"
redef fun is_toc_hidden do return is_empty
end
redef class ImportationListSection
- redef var html_id is lazy do return "section_dependancies_{mentity.nitdoc_id}"
+ redef var html_id is lazy do return "section:{mentity.nitdoc_id}.importation"
redef var html_title is lazy do return "Dependencies"
end
redef class InheritanceListSection
- redef var html_id is lazy do return "section_inheritance_{mentity.nitdoc_id}"
+ redef var html_id is lazy do return "section:{mentity.nitdoc_id}.inheritance"
redef var html_title is lazy do return "Inheritance"
end
redef class IntroArticle
- redef var html_id is lazy do return "article_intro_{mentity.nitdoc_id}"
+ redef var html_id is lazy do return "article:{mentity.nitdoc_id}.intro"
redef var html_title = null
redef var is_hidden = false
redef var is_toc_hidden = true
+ # Link to source to display if any.
+ var html_source_link: nullable Writable is noinit, writable
+
redef fun render_body do
+ var tabs = new DocTabs("{html_id}.tabs", "")
var comment = mentity.html_comment
- if comment != null then addn comment
- super
+ if comment != null then
+ tabs.add_panel new DocTabPanel("{html_tab_id}-comment", "Comment", comment)
+ end
+ for child in children do
+ if child.is_hidden then continue
+ tabs.add_panel new DocTabPanel(child.html_tab_id, child.toc_title, child)
+ end
+ var lnk = html_source_link
+ if lnk != null then
+ tabs.drop_list.items.add new ListItem(lnk)
+ end
+ addn tabs
end
end
redef class ConcernsArticle
- redef var html_id is lazy do return "article_concerns_{mentity.nitdoc_id}"
+ redef var html_id is lazy do return "article:{mentity.nitdoc_id}.concerns"
redef var html_title = "Concerns"
redef fun is_hidden do return concerns.is_empty
redef fun render_body do add concerns.html_list
end
+redef class DefinitionListArticle
+ redef var html_id is lazy do return "article:{mentity.nitdoc_id}.definition-list"
+
+ redef var html_title is lazy do
+ var title = new Template
+ title.add mentity.html_icon
+ title.add mentity.html_link
+ return title
+ end
+
+ redef var html_subtitle is lazy do return mentity.html_namespace
+ redef var toc_title is lazy do return mentity.html_name
+end
+
redef class DefinitionArticle
- redef var html_id is lazy do return "article_definition_{mentity.nitdoc_id}"
+ redef var html_id is lazy do return "article:{mentity.nitdoc_id}.definition"
redef var html_title is lazy do return mentity.html_name
redef var html_subtitle is lazy do return mentity.html_declaration
redef var is_hidden = false
# FIXME diff hack
var is_short_comment: Bool = false is writable
+ # Link to source to display if any.
+ var html_source_link: nullable Writable is noinit, writable
+
redef fun render_body do
+ var tabs = new DocTabs("{html_id}.tabs", "")
if not is_no_body then
var comment
if is_short_comment then
else
comment = mentity.html_comment
end
- if comment != null then addn comment
+ if comment != null then
+ tabs.add_panel new DocTabPanel("{html_tab_id}-comment", "Comment", comment)
+ end
end
- super
+ for child in children do
+ if child.is_hidden then continue
+ tabs.add_panel new DocTabPanel(child.html_tab_id, child.toc_title, child)
+ end
+ var lnk = html_source_link
+ if lnk != null then
+ tabs.drop_list.items.add new ListItem(lnk)
+ end
+ addn tabs
end
end
redef class HierarchyListArticle
- redef var html_id is lazy do return "article_hierarchy_{list_title}_{mentity.nitdoc_id}"
+ redef var html_id is lazy do return "article:{list_title}_{mentity.nitdoc_id}.hierarchy"
redef var html_title is lazy do return list_title
redef fun is_empty do return mentities.is_empty
- redef fun is_toc_hidden do return mentities.is_empty
+ redef var is_toc_hidden = true
redef fun render_body do
var lst = new UnorderedList
end
end
+redef class IntrosRedefsSection
+ redef var html_id is lazy do return "article:{mentity.nitdoc_id}.intros_redefs"
+ redef var toc_title do return "Intros / Redefs"
+ redef var html_title = null
+ redef var html_subtitle = null
+ redef var is_toc_hidden = true
+end
+
redef class IntrosRedefsListArticle
- redef var html_id is lazy do return "article_intros_redefs_{mentity.nitdoc_id}"
+ redef var html_id is lazy do return "article:{list_title}_{mentity.nitdoc_id}.intros_redefs"
redef var html_title is lazy do return list_title
redef fun is_hidden do return mentities.is_empty
redef var is_toc_hidden = true
end
end
+redef class DefinitionLinArticle
+ redef var html_id is lazy do return "article:{mentity.nitdoc_id}.lin"
+ redef var html_title is lazy do return "Linearization"
+ redef fun is_hidden do return mentities.is_empty
+ redef var is_toc_hidden = true
+
+ redef fun render_body do
+ var lst = new UnorderedList
+ lst.css_classes.add "list-unstyled list-labeled"
+ for mentity in mentities do
+ if not mentity isa MPropDef then continue # TODO handle all mentities
+ var tpl = new Template
+ tpl.add mentity.mclassdef.html_namespace
+ var comment = mentity.mclassdef.html_short_comment
+ if comment != null then
+ tpl.add ": "
+ tpl.add comment
+ end
+ var li = new ListItem(tpl)
+ li.css_classes.add "signature"
+ lst.add_li li
+ end
+ add lst
+ end
+end
+
redef class GraphArticle
- redef var html_id is lazy do return "article_graph_{mentity.nitdoc_id}"
+ redef var html_id is lazy do return "article:{mentity.nitdoc_id}.graph"
redef var html_title = null
redef var toc_title do return "Graph"
redef var is_hidden = false