@@ -43,7 +43,7 @@ class ScalaPageCreator(
43
43
override def pageForPackage (p : DPackage ): PackagePageNode =
44
44
PackagePageNode (
45
45
p.name,
46
- contentForPackage (p),
46
+ contentBuilder.mkMemberInfo (p),
47
47
JSet (p.dri),
48
48
p,
49
49
pagesForMembers(p),
@@ -59,16 +59,14 @@ class ScalaPageCreator(
59
59
// Hack, need our own page!
60
60
ClasslikePageNode (
61
61
name,
62
- contentForClass(c. asInstanceOf [ DClass ] ),
62
+ contentBuilder.mkMemberInfo(c ),
63
63
JSet (c.getDri),
64
64
c.asInstanceOf [DClass ],
65
65
JNil ,
66
66
JNil ,
67
67
).modified(name, pagesForMembers(c)) // We need override default page
68
68
}
69
69
70
- override def pageForFunction (f : DFunction ) = super .pageForFunction(f)
71
-
72
70
override def contentForModule (m : DModule ) = {
73
71
def buildBlock = (builder : DocBuilder ) => builder
74
72
.group(kind = ContentKind .Cover ) { gbuilder => gbuilder
@@ -89,16 +87,6 @@ class ScalaPageCreator(
89
87
90
88
contentBuilder.contentForDocumentable(m, buildBlock = buildBlock)
91
89
}
92
-
93
- override def contentForPackage (p : DPackage ) =
94
- contentBuilder.contentForDocumentable(p, buildBlock = _.contentForDescription(p))
95
-
96
- override def contentForClasslike (c : DClasslike ) = throw UnsupportedOperationException (
97
- s " Unable to generate DClasslike using default dokka method for $c! " )
98
-
99
- def contentForClass (c : DClass ) =
100
- contentBuilder.contentForDocumentable(c, buildBlock = _.contentForDescription(c))
101
-
102
90
extension (b : DocBuilder )
103
91
def descriptionIfNotEmpty (d : Documentable ): DocBuilder = {
104
92
val desc = this .contentForDescription(d).asScala.toSeq
@@ -113,103 +101,3 @@ class ScalaPageCreator(
113
101
}
114
102
res
115
103
}
116
-
117
- def contentForDescription (m : Member ) = b.memberInfo(m)
118
-
119
- def contentForScope (s : Documentable & WithScope & WithExtraProperties [_]) =
120
- def groupExtensions (extensions : Seq [Member ]): Seq [DocumentableSubGroup ] =
121
- extensions.groupBy(_.kind).map {
122
- case (Kind .Extension (on, _), members) =>
123
- val signature = Signature (s " extension ( ${on.name}: " ) join on.signature join Signature (" )" )
124
- DocumentableSubGroup (signature, members.toSeq)
125
- case other => sys.error(s " unexpected value: $other" )
126
- }.toSeq
127
-
128
- val (definedMethods, inheritedMethods) = s.membersBy(_.kind.isInstanceOf [Kind .Def ]).byInheritance
129
- val (definedFields, inheritedFiles) = s.membersBy(m => m.kind == Kind .Val || m.kind == Kind .Var ).byInheritance
130
- val (definedClasslikes, inheritedClasslikes) = s.membersBy(m => m.kind.isInstanceOf [Classlike ]).byInheritance
131
- val (definedTypes, inheritedTypes) = s.membersBy(_.kind.isInstanceOf [Kind .Type ]).byInheritance
132
- val (definedGivens, inheritedGives) = s.membersBy(_.kind.isInstanceOf [Kind .Given ]).byInheritance
133
- val (definedExtensions, inheritedExtensions) = s.membersBy(_.kind.isInstanceOf [Kind .Extension ]).byInheritance
134
- val (definedExports, inheritedExports) = s.membersBy(_.kind.isInstanceOf [Kind .Exported ]).byInheritance
135
- val (definedImplicits, inheritedImplicits) = s.membersBy(_.kind.isInstanceOf [Kind .Implicit ]).byInheritance
136
-
137
- b
138
- .documentableTab(" Type members" )(
139
- DocumentableGroup (Some (" Types" ), definedTypes),
140
- DocumentableGroup (Some (" Classlikes" ), definedClasslikes),
141
- DocumentableGroup (Some (" Inherited types" ), inheritedTypes),
142
- DocumentableGroup (Some (" Inherited classlikes" ), inheritedClasslikes)
143
- )
144
- .documentableTab(" Methods" )(
145
- DocumentableGroup (Some (" Defined methods" ), definedMethods),
146
- DocumentableGroup (Some (" Inherited methods" ), inheritedMethods),
147
- )
148
- .documentableTab(" Value members" )(
149
- DocumentableGroup (Some (" Defined value members" ), definedFields),
150
- DocumentableGroup (Some (" Inherited value members" ), inheritedFiles)
151
- )
152
- .documentableTab(" Givens" )(
153
- DocumentableGroup (Some (" Defined givens" ), definedGivens),
154
- DocumentableGroup (Some (" Inherited givens" ), inheritedGives)
155
- )
156
- .documentableTab(" Extensions" )(
157
- DocumentableGroup (Some (" Defined extensions" ), groupExtensions(definedExtensions)),
158
- DocumentableGroup (Some (" Inherited extensions" ), groupExtensions(inheritedExtensions))
159
- )
160
- .documentableTab(" Implicits" )(
161
- DocumentableGroup (Some (" Defined implicits" ), definedImplicits),
162
- DocumentableGroup (Some (" Inherited implicits" ), inheritedImplicits)
163
- )
164
- .documentableTab(" Exports" )(
165
- DocumentableGroup (Some (" Defined exports" ), definedExports),
166
- DocumentableGroup (Some (" Inherited exports" ), inheritedExports),
167
- )
168
-
169
-
170
- def contentForEnum (c : DClass ) =
171
- b.documentableTab(" Enum entries" )(
172
- DocumentableGroup (None , c.membersBy(_.kind == Kind .EnumCase )) // Enum entries cannot be inherited
173
- )
174
-
175
-
176
- def contentForConstructors (c : DClass ) =
177
- b.documentableTab(" Constructors" )(
178
- DocumentableGroup (None , c.membersBy(_.kind.isInstanceOf [Kind .Constructor ]))
179
- )
180
-
181
-
182
- def contentForTypesInfo (c : DClass ) =
183
- val supertypes = c.parents
184
- val subtypes = c.knownChildren
185
-
186
- def contentForTypeLink (builder : DocBuilder , link : LinkToType ): DocBuilder =
187
- builder.group(styles = Set (TextStyle .Paragraph )) { builder =>
188
- link.signature.foldLeft(builder.text(link.kind.name).text(" " )){ (builder, sigElement) => sigElement match
189
- case Link (name, dri) => builder.driLink(name, dri)
190
- case str : String => builder.text(str)
191
- }
192
- }
193
-
194
- val withSupertypes = if supertypes.isEmpty then b else
195
- b.header(2 , " Linear supertypes" )()
196
- .group(
197
- kind = ContentKind .Comment ,
198
- styles = Set (ContentStyle .WithExtraAttributes ),
199
- extra = PropertyContainer .Companion .empty plus SimpleAttr .Companion .header(" Linear supertypes" )
200
- ){ gbdr => gbdr
201
- .group(kind = ContentKind .Symbol , styles = Set (TextStyle .Monospace )){ grbdr => grbdr
202
- .list(supertypes.toList, separator = " " )(contentForTypeLink)
203
- }
204
- }
205
-
206
- val withSubtypes = if (subtypes.isEmpty) withSupertypes else
207
- withSupertypes.header(2 , " Known subtypes" )()
208
- .group(
209
- kind = ContentKind .Comment ,
210
- styles = Set (ContentStyle .WithExtraAttributes ),
211
- extra = PropertyContainer .Companion .empty plus SimpleAttr .Companion .header(" Known subtypes" )
212
- ) { _.group(kind = ContentKind .Symbol , styles = Set (TextStyle .Monospace )) {
213
- _.list(subtypes.toList, separator= " " )(contentForTypeLink)
214
- }
215
- }
0 commit comments