src/doc/api: add links to renderer code
[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_base
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.add_page new OverviewPage("overview", "Overview")
27 doc.add_page new SearchPage("search", "Index")
28 for mgroup in doc.model.collect_mgroups(doc.filter) do
29 doc.add_page new ReadmePage(mgroup)
30 doc.add_page new MGroupPage(mgroup)
31 end
32 for mmodule in doc.model.mmodules do
33 doc.add_page new MModulePage(mmodule)
34 end
35 for mclass in doc.model.mclasses do
36 doc.add_page new MClassPage(mclass)
37 end
38 for mproperty in doc.model.mproperties do
39 doc.add_page new MPropertyPage(mproperty)
40 end
41 end
42 end
43
44 # The Nitdoc overview page.
45 class OverviewPage
46 super DocPage
47 end
48
49 # The Nidoc full index page.
50 class SearchPage
51 super DocPage
52 end
53
54 # A DocPage documenting a MEntity.
55 class MEntityPage
56 autoinit mentity
57 super DocPage
58
59 # Type of MEntity documented by this page.
60 type MENTITY: MEntity
61
62 # MEntity documented by this page.
63 var mentity: MENTITY
64
65 redef var id is lazy do return mentity.nitdoc_id
66 redef var title is lazy do return mentity.nitdoc_name
67 end
68
69 # A page that displays a `MGroup` README.
70 class ReadmePage
71 super MEntityPage
72
73 redef type MENTITY: MGroup
74 redef var id is lazy do return "readme_{mentity.nitdoc_id}"
75 end
76
77 # A documentation page about a MGroup.
78 class MGroupPage
79 super MEntityPage
80
81 redef type MENTITY: MGroup
82 end
83
84 # A documentation page about a MModule.
85 class MModulePage
86 super MEntityPage
87
88 redef type MENTITY: MModule
89 end
90
91 # A documentation page about a MClass.
92 class MClassPage
93 super MEntityPage
94
95 redef type MENTITY: MClass
96 end
97
98 # A documentation page about a MProperty.
99 class MPropertyPage
100 super MEntityPage
101
102 redef type MENTITY: MProperty
103 end