nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vim_autocomplete: remove ModelView dependency
[nit.git]
/
src
/
doc
/
doc_phases
/
doc_structure.nit
diff --git
a/src/doc/doc_phases/doc_structure.nit
b/src/doc/doc_phases/doc_structure.nit
index
79c634f
..
b328fb9
100644
(file)
--- a/
src/doc/doc_phases/doc_structure.nit
+++ b/
src/doc/doc_phases/doc_structure.nit
@@
-47,15
+47,15
@@
end
redef class OverviewPage
redef fun apply_structure(v, doc) do
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
root.add_child article
- # Projects list
- var mprojects = doc.model.mprojects.to_a
+ # Packages list
+ var mpackages = doc.model.mpackages.to_a
var sorter = new MConcernRankSorter
var sorter = new MConcernRankSorter
- sorter.sort mprojects
- var section = new ProjectsSection("projects.section")
- for mproject in mprojects do
- section.add_child new DefinitionArticle("{mproject.nitdoc_id}.definition", mproject)
+ sorter.sort mpackages
+ var section = new DocSection("packages.section", "Packages")
+ for mpackage in mpackages do
+ section.add_child new DefinitionArticle("{mpackage.nitdoc_id}.definition", null, mpackage)
end
article.add_child section
end
end
article.add_child section
end
@@
-63,38
+63,38
@@
end
redef class SearchPage
redef fun apply_structure(v, doc) do
redef class SearchPage
redef fun apply_structure(v, doc) do
- var mmodules = doc.mmodules.to_a
+ var mmodules = doc.model.mmodules.to_a
v.name_sorter.sort(mmodules)
v.name_sorter.sort(mmodules)
- var mclasses = doc.mclasses.to_a
+ var mclasses = doc.model.mclasses.to_a
v.name_sorter.sort(mclasses)
v.name_sorter.sort(mclasses)
- var mprops = doc.mproperties.to_a
+ var mprops = doc.model.mproperties.to_a
v.name_sorter.sort(mprops)
v.name_sorter.sort(mprops)
- root.add_child new IndexArticle("index.article", mmodules, mclasses, mprops)
+ root.add_child new IndexArticle("index.article", null, mmodules, mclasses, mprops)
end
end
redef class MGroupPage
redef fun apply_structure(v, doc) do
end
end
redef class MGroupPage
redef fun apply_structure(v, doc) do
- var section = new MEntitySection("{mentity.nitdoc_name}.section", mentity)
+ var section = new MEntitySection("{mentity.nitdoc_name}.section", null, mentity)
root.add_child section
if mentity.is_root then
root.add_child section
if mentity.is_root then
- section.add_child new IntroArticle("{mentity.mproject.nitdoc_id}.intro", mentity.mproject)
+ section.add_child new IntroArticle("{mentity.mpackage.nitdoc_id}.intro", null, mentity.mpackage)
else
else
- section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", mentity)
+ section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", null, mentity)
end
var concerns = self.concerns
if concerns == null or concerns.is_empty then return
# FIXME avoid diff
end
var concerns = self.concerns
if concerns == null or concerns.is_empty then return
# FIXME avoid diff
- mentity.mproject.booster_rank = -1000
+ mentity.mpackage.booster_rank = -1000
mentity.booster_rank = -1000
concerns.sort_with(v.concerns_sorter)
mentity.booster_rank = -1000
concerns.sort_with(v.concerns_sorter)
- mentity.mproject.booster_rank = 0
+ mentity.mpackage.booster_rank = 0
mentity.booster_rank = 0
mentity.booster_rank = 0
- section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", mentity, concerns)
+ section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", null, mentity, concerns)
for mentity in concerns do
for mentity in concerns do
- var ssection = new ConcernSection("concern:{mentity.nitdoc_id}", mentity)
+ var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", null, mentity)
if mentity isa MModule then
if mentity isa MModule then
- ssection.add_child new DefinitionArticle("{mentity.nitdoc_id}.definition", mentity)
+ ssection.add_child new DefinitionArticle("{mentity.nitdoc_id}.definition", null, mentity)
end
section.add_child ssection
end
end
section.add_child ssection
end
@@
-103,38
+103,38
@@
end
redef class MModulePage
redef fun apply_structure(v, doc) do
redef class MModulePage
redef fun apply_structure(v, doc) do
- var section = new MEntitySection("{mentity.nitdoc_name}.section", mentity)
+ var section = new MEntitySection("{mentity.nitdoc_name}.section", null, mentity)
root.add_child section
root.add_child section
- section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", mentity)
+ section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", null, mentity)
var concerns = self.concerns
if concerns == null or concerns.is_empty then return
# FIXME avoid diff
var concerns = self.concerns
if concerns == null or concerns.is_empty then return
# FIXME avoid diff
- mentity.mgroup.mproject.booster_rank = -1000
+ mentity.mgroup.mpackage.booster_rank = -1000
mentity.mgroup.booster_rank = -1000
mentity.booster_rank = -1000
concerns.sort_with(v.concerns_sorter)
mentity.mgroup.booster_rank = -1000
mentity.booster_rank = -1000
concerns.sort_with(v.concerns_sorter)
- mentity.mgroup.mproject.booster_rank = 0
+ mentity.mgroup.mpackage.booster_rank = 0
mentity.mgroup.booster_rank = 0
mentity.booster_rank = 0
mentity.mgroup.booster_rank = 0
mentity.booster_rank = 0
- section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", mentity, concerns)
+ section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", null, mentity, concerns)
# reference list
for mentity in concerns do
# reference list
for mentity in concerns do
- var ssection = new ConcernSection("concern:{mentity.nitdoc_id}", mentity)
+ var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", null, mentity)
if mentity isa MModule then
var mclasses = mclasses_for_mmodule(mentity).to_a
v.name_sorter.sort(mclasses)
for mclass in mclasses do
var article = new DefinitionListArticle(
if mentity isa MModule then
var mclasses = mclasses_for_mmodule(mentity).to_a
v.name_sorter.sort(mclasses)
for mclass in mclasses do
var article = new DefinitionListArticle(
- "{mclass.intro.nitdoc_id}.definition-list", mclass)
+ "{mclass.intro.nitdoc_id}.definition-list", null, mclass)
var mclassdefs = mclassdefs_for(mclass).to_a
if not mclassdefs.has(mclass.intro) then
article.add_child(new DefinitionArticle(
var mclassdefs = mclassdefs_for(mclass).to_a
if not mclassdefs.has(mclass.intro) then
article.add_child(new DefinitionArticle(
- "{mclass.intro.nitdoc_id}.definition", mclass.intro))
+ "{mclass.intro.nitdoc_id}.definition", null, mclass.intro))
end
doc.mainmodule.linearize_mclassdefs(mclassdefs)
for mclassdef in mclassdefs do
article.add_child(new DefinitionArticle(
end
doc.mainmodule.linearize_mclassdefs(mclassdefs)
for mclassdef in mclassdefs do
article.add_child(new DefinitionArticle(
- "{mclassdef.nitdoc_id}.definition", mclassdef))
+ "{mclassdef.nitdoc_id}.definition", null, mclassdef))
end
ssection.add_child article
end
end
ssection.add_child article
end
@@
-147,7
+147,7
@@
redef class MModulePage
private fun mclasses_for_mmodule(mmodule: MModule): Set[MClass] do
var mclasses = new HashSet[MClass]
for mclass in self.mclasses do
private fun mclasses_for_mmodule(mmodule: MModule): Set[MClass] do
var mclasses = new HashSet[MClass]
for mclass in self.mclasses do
- if mclass.intro.mmodule == mmodule then
+ if mclass.intro_mmodule == mmodule then
mclasses.add mclass
end
end
mclasses.add mclass
end
end
@@
-168,29
+168,28
@@
end
redef class MClassPage
redef fun apply_structure(v, doc) do
redef class MClassPage
redef fun apply_structure(v, doc) do
- var section = new MEntitySection("{mentity.nitdoc_name}.section", mentity)
+ var section = new MEntitySection("{mentity.nitdoc_name}.section", null, mentity)
root.add_child section
root.add_child section
- section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", mentity)
+ section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", null, mentity)
var concerns = self.concerns
if concerns == null or concerns.is_empty then return
# FIXME diff hack
var concerns = self.concerns
if concerns == null or concerns.is_empty then return
# FIXME diff hack
- mentity.intro_mmodule.mgroup.mproject.booster_rank = -1000
+ mentity.intro_mmodule.mgroup.mpackage.booster_rank = -1000
mentity.intro_mmodule.mgroup.booster_rank = -1000
mentity.intro_mmodule.booster_rank = -1000
concerns.sort_with(v.concerns_sorter)
mentity.intro_mmodule.mgroup.booster_rank = -1000
mentity.intro_mmodule.booster_rank = -1000
concerns.sort_with(v.concerns_sorter)
- mentity.intro_mmodule.mgroup.mproject.booster_rank = 0
+ mentity.intro_mmodule.mgroup.mpackage.booster_rank = 0
mentity.intro_mmodule.mgroup.booster_rank = 0
mentity.intro_mmodule.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
var minit = mentity.root_init
if minit != null then
- constructors.add_child new DefinitionArticle("{minit.nitdoc_id}.definition", minit)
+ constructors.add_child new DefinitionArticle("{minit.nitdoc_id}.definition", null, minit)
end
section.add_child constructors
end
section.add_child constructors
- section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", mentity, concerns)
+ section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", null, mentity, concerns)
for mentity in concerns do
for mentity in concerns do
- var ssection = new ConcernSection("concern:{mentity.nitdoc_id}", mentity)
+ var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", null, mentity)
if mentity isa MModule then
var mprops = mproperties_for(mentity)
var by_kind = new PropertiesByKind.with_elements(mprops)
if mentity isa MModule then
var mprops = mproperties_for(mentity)
var by_kind = new PropertiesByKind.with_elements(mprops)
@@
-201,10
+200,10
@@
redef class MClassPage
if mpropdef isa MMethodDef and mpropdef.mproperty.is_init then
if mpropdef == minit then continue
constructors.add_child new DefinitionArticle(
if mpropdef isa MMethodDef and mpropdef.mproperty.is_init then
if mpropdef == minit then continue
constructors.add_child new DefinitionArticle(
- "{mpropdef.nitdoc_id}.definition", mpropdef)
+ "{mpropdef.nitdoc_id}.definition", null, mpropdef)
else
ssection.add_child new DefinitionArticle(
else
ssection.add_child new DefinitionArticle(
- "{mpropdef.nitdoc_id}.definition", mpropdef)
+ "{mpropdef.nitdoc_id}.definition", null, mpropdef)
end
end
end
end
end
end
@@
-244,29
+243,29
@@
end
redef class MPropertyPage
redef fun apply_structure(v, doc) do
redef class MPropertyPage
redef fun apply_structure(v, doc) do
- var section = new MEntitySection("{mentity.nitdoc_name}.section", mentity)
+ var section = new MEntitySection("{mentity.nitdoc_name}.section", null, mentity)
root.add_child section
root.add_child section
- section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", mentity)
+ section.add_child new IntroArticle("{mentity.nitdoc_id}.intro", null, mentity)
var concerns = self.concerns
if concerns == null or concerns.is_empty then return
# FIXME diff hack
var concerns = self.concerns
if concerns == null or concerns.is_empty then return
# FIXME diff hack
- mentity.intro.mclassdef.mmodule.mgroup.mproject.booster_rank = -1000
+ mentity.intro.mclassdef.mmodule.mgroup.mpackage.booster_rank = -1000
mentity.intro.mclassdef.mmodule.mgroup.booster_rank = -1000
mentity.intro.mclassdef.mmodule.booster_rank = -1000
concerns.sort_with(v.concerns_sorter)
mentity.intro.mclassdef.mmodule.mgroup.booster_rank = -1000
mentity.intro.mclassdef.mmodule.booster_rank = -1000
concerns.sort_with(v.concerns_sorter)
- mentity.intro.mclassdef.mmodule.mgroup.mproject.booster_rank = 0
+ mentity.intro.mclassdef.mmodule.mgroup.mpackage.booster_rank = 0
mentity.intro.mclassdef.mmodule.mgroup.booster_rank = 0
mentity.intro.mclassdef.mmodule.booster_rank = 0
mentity.intro.mclassdef.mmodule.mgroup.booster_rank = 0
mentity.intro.mclassdef.mmodule.booster_rank = 0
- section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", mentity, concerns)
+ section.add_child new ConcernsArticle("{mentity.nitdoc_id}.concerns", null, mentity, concerns)
for mentity in concerns do
for mentity in concerns do
- var ssection = new ConcernSection("concern:{mentity.nitdoc_id}", mentity)
+ var ssection = new ConcernSection("{mentity.nitdoc_id}.concern", null, mentity)
if mentity isa MModule then
# Add mproperties
var mpropdefs = mpropdefs_for(mentity).to_a
v.name_sorter.sort(mpropdefs)
for mpropdef in mpropdefs do
ssection.add_child new DefinitionArticle(
if mentity isa MModule then
# Add mproperties
var mpropdefs = mpropdefs_for(mentity).to_a
v.name_sorter.sort(mpropdefs)
for mpropdef in mpropdefs do
ssection.add_child new DefinitionArticle(
- "{mpropdef.nitdoc_id}.definition", mpropdef)
+ "{mpropdef.nitdoc_id}.definition", null, mpropdef)
end
end
section.add_child ssection
end
end
section.add_child ssection
@@
-295,30
+294,26
@@
end
# A group of sections that can be displayed together in a tab panel.
class PanelGroup
super DocSection
# 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
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
# 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
# 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.
end
# An article about a Mentity.
@@
-329,6
+324,17
@@
abstract class MEntityArticle
super DocArticle
end
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.
# A section about a Mentity.
#
# Used to regroup content about a MEntity.
@@
-343,6
+349,9
@@
end
class IntroArticle
super MEntityComposite
super DocArticle
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.
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
# Concerns to list in this article.
var concerns: ConcernsTree
+
+ redef fun is_hidden do return concerns.is_empty
end
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
class DefinitionListArticle
super TabbedGroup
super MEntityArticle
@@
-362,15
+373,12
@@
end
# An article that display the definition text of a MEntity.
class DefinitionArticle
super MEntityArticle
# An article that display the definition text of a MEntity.
class DefinitionArticle
super MEntityArticle
-end
-# The main project article.
-class HomeArticle
- super DocArticle
+ redef var is_hidden = false
end
end
-# The project list.
-class ProjectsSection
+# The main package article.
+class HomeArticle
super DocArticle
end
super DocArticle
end
@@
-386,6
+394,10
@@
class IndexArticle
# List of mproperties to display.
var mprops: Array[MProperty]
# 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
# Concerns ranking
end
# Concerns ranking
@@
-427,7
+439,7
@@
redef class MConcern
fun concern_rank: Int is abstract
end
fun concern_rank: Int is abstract
end
-redef class MProject
+redef class MPackage
redef var concern_rank is lazy do
var max = 0
for mgroup in mgroups do
redef var concern_rank is lazy do
var max = 0
for mgroup in mgroups do