Merge: Correct warn on noautoinit
[nit.git] / src / doc / doc_phases / doc_pages.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Create DocPage instances for each documentated Mentity.
16 module doc_pages
17
18 import doc_extract
19
20 # ExtractionPhase populates the DocModel with DocPage.
21 class MakePagePhase
22 super DocPhase
23
24 # Instanciates documentation pages for the given DocModel.
25 redef fun apply do
26 doc.pages.add new OverviewPage("Overview")
27 doc.pages.add new SearchPage("Index")
28 for mgroup in doc.mgroups do
29 doc.pages.add new MGroupPage(mgroup.nitdoc_name, mgroup)
30 end
31 for mmodule in doc.mmodules do
32 doc.pages.add new MModulePage(mmodule.nitdoc_name, mmodule)
33 end
34 for mclass in doc.mclasses do
35 doc.pages.add new MClassPage(mclass.nitdoc_name, mclass)
36 end
37 for mproperty in doc.mproperties do
38 doc.pages.add new MPropertyPage(mproperty.nitdoc_name, mproperty)
39 end
40 end
41 end
42
43 # The Nitdoc overview page.
44 class OverviewPage
45 super DocPage
46 end
47
48 # The Nidoc full index page.
49 class SearchPage
50 super DocPage
51 end
52
53 # A DocPage documenting a MEntity.
54 class MEntityPage
55 super DocPage
56
57 # Type of MEntity documented by this page.
58 type MENTITY: MEntity
59
60 # MEntity documented by this page.
61 var mentity: MENTITY
62 end
63
64 # A documentation page about a MGroup.
65 class MGroupPage
66 super MEntityPage
67
68 redef type MENTITY: MGroup
69 end
70
71 # A documentation page about a MModule.
72 class MModulePage
73 super MEntityPage
74
75 redef type MENTITY: MModule
76 end
77
78 # A documentation page about a MClass.
79 class MClassPage
80 super MEntityPage
81
82 redef type MENTITY: MClass
83 end
84
85 # A documentation page about a MProperty.
86 class MPropertyPage
87 super MEntityPage
88
89 redef type MENTITY: MProperty
90 end