@@ -44,7 +44,14 @@ type docItem =
44
44
(* * Additional documentation for constructors and record fields, if available. *)
45
45
}
46
46
| Module of docsForModule
47
- | ModuleType of docsForModule
47
+ | ModuleType of {
48
+ id : string ;
49
+ docstring : string list ;
50
+ deprecated : string option ;
51
+ name : string ;
52
+ source : source ;
53
+ items : docItem list ;
54
+ }
48
55
| ModuleAlias of {
49
56
id : string ;
50
57
docstring : string list ;
@@ -57,6 +64,7 @@ and docsForModule = {
57
64
docstring : string list ;
58
65
deprecated : string option ;
59
66
name : string ;
67
+ moduletype : string option ;
60
68
source : source ;
61
69
items : docItem list ;
62
70
}
@@ -195,6 +203,10 @@ let rec stringifyDocItem ?(indentation = 0) ~originalEnv (item : docItem) =
195
203
match m.deprecated with
196
204
| Some d -> Some (wrapInQuotes d)
197
205
| None -> None );
206
+ ( " moduletype" ,
207
+ match m.moduletype with
208
+ | Some path -> Some (wrapInQuotes path)
209
+ | None -> None );
198
210
(" docstrings" , Some (stringifyDocstrings m.docstring));
199
211
( " source" ,
200
212
Some (stringifySource ~indentation: (indentation + 1 ) m.source) );
@@ -356,6 +368,7 @@ let extractDocs ~entryPointFile ~debug =
356
368
id = modulePath |> List. rev |> ident;
357
369
docstring = structure.docstring |> List. map String. trim;
358
370
name = structure.name;
371
+ moduletype = None ;
359
372
deprecated = structure.deprecated;
360
373
source =
361
374
{
@@ -439,6 +452,7 @@ let extractDocs ~entryPointFile ~debug =
439
452
{
440
453
id = modulePath |> List. rev |> ident;
441
454
name = m.name;
455
+ moduletype = None ;
442
456
docstring = item.docstring @ m.docstring;
443
457
deprecated = item.deprecated;
444
458
source;
@@ -469,12 +483,13 @@ let extractDocs ~entryPointFile ~debug =
469
483
(extractDocsForModule
470
484
~module Path:(interface.name :: modulePath)
471
485
interface))
472
- | Module {type_ = Constraint (Structure m , Ident _ )} ->
473
- (* module M: T = { }. Print M *)
474
- Some
475
- (Module
476
- (extractDocsForModule
477
- ~module Path:(m.name :: modulePath) m))
486
+ | Module {type_ = Constraint (Structure m , Ident p )} ->
487
+ (* module M: T = { <impl> }. Print M *)
488
+ let docs =
489
+ extractDocsForModule ~module Path:(m.name :: modulePath)
490
+ m
491
+ in
492
+ Some (Module {docs with moduletype = Some (Path. name p)})
478
493
| _ -> None );
479
494
}
480
495
in
0 commit comments