this repo has no description
1open StdLabels
2
3let rec unit (t : Odoc_model.Lang.Compilation_unit.t) =
4 let url = Url.Path.from_identifier t.id in
5 let rest =
6 match t.content with Module sign -> signature sign | Pack _ -> []
7 in
8 url :: rest
9
10and signature (t : Odoc_model.Lang.Signature.t) =
11 let rec add_items ~don't acc = function
12 | [] -> List.concat (List.rev acc)
13 | i :: is -> (
14 match i with
15 | Odoc_model.Lang.Signature.Comment `Stop ->
16 add_items ~don't:(not don't) acc is
17 | _ when don't -> add_items ~don't acc is
18 | Module (_, md) -> add_items ~don't (module_ md :: acc) is
19 | ModuleType mty -> add_items ~don't (module_type mty :: acc) is
20 | Include incl -> add_items ~don't (include_ incl :: acc) is
21 | Open _ | ModuleSubstitution _ | ModuleTypeSubstitution _
22 | TypeSubstitution _ | Type _ | TypExt _ | Exception _ | Value _
23 | Class _ | ClassType _
24 | Comment (`Docs _) ->
25 add_items ~don't acc is)
26 in
27 add_items ~don't:false [] t.items
28
29and simple_expansion (t : Odoc_model.Lang.ModuleType.simple_expansion) =
30 match t with
31 | Signature sg -> signature sg
32 | Functor (p, expn) ->
33 let subpages =
34 match p with Unit -> [] | Named { expr; _ } -> module_type_expr expr
35 in
36 subpages @ simple_expansion expn
37
38and module_type_expr (t : Odoc_model.Lang.ModuleType.expr) =
39 let open Odoc_model.Lang.ModuleType in
40 let opt_expansion e_opt =
41 match e_opt with Some e -> simple_expansion e | None -> []
42 in
43 match t with
44 | Signature sg -> signature sg
45 | Functor (f_parameter, e) ->
46 let sub =
47 match f_parameter with Unit -> [] | Named f -> module_type_expr f.expr
48 in
49 sub @ module_type_expr e
50 | Path { p_expansion = e_opt; _ }
51 | With { w_expansion = e_opt; _ }
52 | TypeOf { t_expansion = e_opt; _ }
53 | Strengthen { s_expansion = e_opt; _ } ->
54 opt_expansion e_opt
55
56and module_ (t : Odoc_model.Lang.Module.t) =
57 let url = Url.Path.from_identifier t.id in
58 let subpages =
59 match t.type_ with
60 | Alias (_, Some e) -> simple_expansion e
61 | Alias (_, None) -> []
62 | ModuleType expr -> module_type_expr expr
63 in
64 url :: subpages
65
66and module_type (t : Odoc_model.Lang.ModuleType.t) =
67 match t.expr with
68 | None -> []
69 | Some expr ->
70 let url = Url.Path.from_identifier t.id in
71 let subpages = module_type_expr expr in
72 url :: subpages
73
74and include_ (t : Odoc_model.Lang.Include.t) = signature t.expansion.content
75
76and page (t : Odoc_model.Lang.Page.t) = [ Url.Path.from_identifier t.name ]