@@ -141,14 +141,15 @@ defmodule ExDoc.Retriever do
141
141
group_for_doc = config . group_for_doc
142
142
annotations_for_docs = config . annotations_for_docs
143
143
144
- docs = get_docs ( module_data , source , group_for_doc , annotations_for_docs )
144
+ { docs , docs_groups } = get_docs ( module_data , source , group_for_doc , annotations_for_docs )
145
145
146
146
moduledoc_groups = Map . get ( metadata , :groups , [ ] )
147
147
148
148
docs_groups =
149
- get_docs_groups ( moduledoc_groups ++ config . docs_groups ++ module_data . default_groups , docs )
150
-
151
- docs = Enum . map ( docs , & Map . put ( & 1 , :group , & 1 . group . title ) )
149
+ get_docs_groups (
150
+ moduledoc_groups ++ config . docs_groups ++ module_data . default_groups ,
151
+ docs_groups
152
+ )
152
153
153
154
metadata = Map . put ( metadata , :kind , module_data . type )
154
155
group = GroupMatcher . match_module ( config . groups_for_modules , module , module_data . id , metadata )
@@ -203,13 +204,15 @@ defmodule ExDoc.Retriever do
203
204
defp get_docs ( module_data , source , group_for_doc , annotations_for_docs ) do
204
205
{ :docs_v1 , _ , _ , _ , _ , _ , docs } = module_data . docs
205
206
206
- nodes =
207
+ { nodes , groups } =
207
208
for doc <- docs ,
208
209
doc_data = module_data . language . doc_data ( doc , module_data ) do
209
- get_doc ( doc , doc_data , module_data , source , group_for_doc , annotations_for_docs )
210
+ { _node , _group } =
211
+ get_doc ( doc , doc_data , module_data , source , group_for_doc , annotations_for_docs )
210
212
end
213
+ |> Enum . unzip ( )
211
214
212
- filter_defaults ( nodes )
215
+ { filter_defaults ( nodes ) , groups }
213
216
end
214
217
215
218
defp get_doc ( doc , doc_data , module_data , source , group_for_doc , annotations_for_docs ) do
@@ -236,10 +239,10 @@ defmodule ExDoc.Retriever do
236
239
doc_ast ( content_type , source_doc , file: doc_file , line: doc_line + 1 ) ||
237
240
doc_data . doc_fallback . ( )
238
241
239
- group = normalize_group ( group_for_doc . ( metadata ) || doc_data . default_group )
242
+ group = normalize_group ( group_for_doc . ( metadata ) || doc_data . default_group )
240
243
id = doc_data . id_key <> nil_or_name ( name , arity )
241
244
242
- % ExDoc.DocNode {
245
+ doc_node = % ExDoc.DocNode {
243
246
id: id ,
244
247
name: name ,
245
248
arity: arity ,
@@ -253,9 +256,11 @@ group = normalize_group(group_for_doc.(metadata) || doc_data.default_group)
253
256
specs: doc_data . specs ,
254
257
source_url: source_url ,
255
258
type: doc_data . type ,
256
- group: group ,
259
+ group: group . title ,
257
260
annotations: annotations
258
261
}
262
+
263
+ { doc_node , group }
259
264
end
260
265
261
266
defp get_defaults ( _name , _arity , 0 ) , do: [ ]
@@ -276,11 +281,10 @@ group = normalize_group(group_for_doc.(metadata) || doc_data.default_group)
276
281
end )
277
282
end
278
283
279
- defp get_docs_groups ( module_groups , doc_nodes ) do
284
+ defp get_docs_groups ( module_groups , nodes_groups ) do
280
285
module_groups = Enum . map ( module_groups , & normalize_group / 1 )
281
286
282
287
# Doc nodes already have normalized groups
283
- nodes_groups = Enum . map ( doc_nodes , & & 1 . group )
284
288
nodes_groups_descriptions = Map . new ( nodes_groups , & { & 1 . title , & 1 . description } )
285
289
286
290
normal_groups = module_groups ++ nodes_groups
0 commit comments