X-Git-Url: http://nitlanguage.org diff --git a/src/doc/doc_phases/doc_structure.nit b/src/doc/doc_phases/doc_structure.nit index d29a5df..f9824d3 100644 --- a/src/doc/doc_phases/doc_structure.nit +++ b/src/doc/doc_phases/doc_structure.nit @@ -47,13 +47,13 @@ end redef class OverviewPage redef fun apply_structure(v, doc) do - var article = new HomeArticle("home.article") + var article = new HomeArticle("home.article", "Home") root.add_child article # Projects list var mprojects = doc.model.mprojects.to_a var sorter = new MConcernRankSorter sorter.sort mprojects - var section = new ProjectsSection("projects.section") + var section = new DocSection("projects.section", "Projects") for mproject in mprojects do section.add_child new DefinitionArticle("{mproject.nitdoc_id}.definition", mproject) end @@ -92,7 +92,7 @@ redef class MGroupPage mentity.booster_rank = 0 section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", mentity, concerns) for mentity in concerns do - var ssection = new ConcernSection("concern:{mentity.nitdoc_id}", mentity) + var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", mentity) if mentity isa MModule then ssection.add_child new DefinitionArticle("{mentity.nitdoc_id}.definition", mentity) end @@ -119,7 +119,7 @@ redef class MModulePage section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", mentity, concerns) # reference list for mentity in concerns do - var ssection = new ConcernSection("concern:{mentity.nitdoc_id}", mentity) + var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", mentity) if mentity isa MModule then var mclasses = mclasses_for_mmodule(mentity).to_a v.name_sorter.sort(mclasses) @@ -181,8 +181,7 @@ redef class MClassPage mentity.intro_mmodule.mgroup.mproject.booster_rank = 0 mentity.intro_mmodule.mgroup.booster_rank = 0 mentity.intro_mmodule.booster_rank = 0 - var constructors = new ConstructorsSection( - "{mentity.nitdoc_id}.constructors", mentity) + var constructors = new DocSection("{mentity.nitdoc_id}.constructors", "Constructors") var minit = mentity.root_init if minit != null then constructors.add_child new DefinitionArticle("{minit.nitdoc_id}.definition", minit) @@ -190,7 +189,7 @@ redef class MClassPage section.add_child constructors section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", mentity, concerns) for mentity in concerns do - var ssection = new ConcernSection("concern:{mentity.nitdoc_id}", mentity) + var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", mentity) if mentity isa MModule then var mprops = mproperties_for(mentity) var by_kind = new PropertiesByKind.with_elements(mprops) @@ -259,7 +258,7 @@ redef class MPropertyPage mentity.intro.mclassdef.mmodule.booster_rank = 0 section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", mentity, concerns) for mentity in concerns do - var ssection = new ConcernSection("concern:{mentity.nitdoc_id}", mentity) + var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", mentity) if mentity isa MModule then # Add mproperties var mpropdefs = mpropdefs_for(mentity).to_a @@ -295,30 +294,26 @@ end # A group of sections that can be displayed together in a tab panel. class PanelGroup super DocSection - - # The title of this group. - var group_title: String end # A DocComposite element about a MEntity. class MEntityComposite super DocComposite + redef fun title do return mentity.nitdoc_name + # MEntity documented by this page element. var mentity: MEntity end -# A list of constructors. -class ConstructorsSection - super MEntitySection -end - # A Section about a Concern. # # Those sections are used to build the page summary. class ConcernSection super MEntityComposite super DocSection + + redef fun is_toc_hidden do return is_hidden end # An article about a Mentity. @@ -329,6 +324,17 @@ abstract class MEntityArticle super DocArticle end +# An article that displays a list of mentities. +class MEntitiesListArticle + super DocArticle + + # MEntities to display. + var mentities: Array[MEntity] + + redef fun is_hidden do return mentities.is_empty +end + + # A section about a Mentity. # # Used to regroup content about a MEntity. @@ -343,6 +349,9 @@ end class IntroArticle super MEntityComposite super DocArticle + + redef var is_hidden = false + redef var is_toc_hidden = true end # An article that display a ConcernsTreee as a list. @@ -351,9 +360,11 @@ class ConcernsArticle # Concerns to list in this article. var concerns: ConcernsTree + + redef fun is_hidden do return concerns.is_empty end -# An article that displaus a list of definition belonging to a MEntity. +# An article that displays a list of definition belonging to a MEntity. class DefinitionListArticle super TabbedGroup super MEntityArticle @@ -362,6 +373,8 @@ end # An article that display the definition text of a MEntity. class DefinitionArticle super MEntityArticle + + redef var is_hidden = false end # The main project article. @@ -369,11 +382,6 @@ class HomeArticle super DocArticle end -# The project list. -class ProjectsSection - super DocArticle -end - # An article that display an index of mmodules, mclasses and mproperties. class IndexArticle super DocArticle @@ -386,4 +394,8 @@ class IndexArticle # List of mproperties to display. var mprops: Array[MProperty] + + redef fun is_hidden do + return mmodules.is_empty and mclasses.is_empty and mprops.is_empty + end end