File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,6 @@ module Toc : sig
11
11
12
12
val of_lang : Odoc_model.Sidebar.PageToc .t -> t
13
13
14
- val remove_common_root : t -> t
15
- (* * Returns the deepest subdir containing all files. *)
16
-
17
14
val to_sidebar :
18
15
?fallback : string -> (Url.Path .t * Inline .one -> Block .one ) -> t -> Block .t
19
16
end = struct
@@ -56,10 +53,6 @@ end = struct
56
53
in
57
54
of_lang ~parent_id: None dir
58
55
59
- let rec remove_common_root = function
60
- | Item (_ , [ d ]) -> remove_common_root d
61
- | x -> x
62
-
63
56
let rec to_sidebar ?(fallback = " root" ) convert (Item (name , content )) =
64
57
let name =
65
58
match name with
@@ -83,7 +76,7 @@ type t = { pages : pages list; libraries : library list }
83
76
let of_lang (v : Odoc_model.Sidebar.t ) =
84
77
let pages =
85
78
let page_hierarchy { Odoc_model.Sidebar. hierarchy_name; pages } =
86
- let hierarchy = Toc. of_lang pages |> Toc. remove_common_root in
79
+ let hierarchy = Toc. of_lang pages in
87
80
Some { name = hierarchy_name; pages = hierarchy }
88
81
in
89
82
Odoc_utils.List. filter_map page_hierarchy v.pages
Original file line number Diff line number Diff line change @@ -182,10 +182,13 @@ module PageToc = struct
182
182
let contents = ordered @ unordered in
183
183
(contents, index)
184
184
185
+ let rec remove_common_root (v : t ) =
186
+ match v with [ (_, Dir v) ], None -> remove_common_root v | _ -> v
187
+
185
188
let of_list l =
186
189
let dir = empty_t None in
187
190
List. iter (add dir) l;
188
- t_of_in_progress dir
191
+ t_of_in_progress dir |> remove_common_root
189
192
end
190
193
191
194
type toc = PageToc .t
You can’t perform that action at this time.
0 commit comments