File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,19 @@ module ModuleName = Odoc_model.Names.ModuleName
88
99type t = Entry .t Tree .t
1010
11+ let compare_entry (e1 : Entry.t ) (e2 : Entry.t ) =
12+ let int_of_kind (kind : Entry.kind ) =
13+ match kind with
14+ | Page _ -> - 10
15+ | Dir -> 0
16+ | Module _ -> 10
17+ | Impl -> 20
18+ | _ -> 30
19+ in
20+ match Int. compare (int_of_kind e1.kind) (int_of_kind e2.kind) with
21+ | 0 -> Astring.String. compare (Id. name e1.id) (Id. name e2.id)
22+ | i -> i
23+
1124let rec t_of_in_progress (dir : In_progress.in_progress ) : t =
1225 let entry_of_page page =
1326 let kind = Entry. Page page.Lang.Page. frontmatter in
@@ -145,10 +158,7 @@ let rec t_of_in_progress (dir : In_progress.in_progress) : t =
145158 |> List. map snd
146159 in
147160 let unordered =
148- List. sort
149- (fun (x , _ ) (y , _ ) ->
150- String. compare (Paths.Identifier. name x) (Paths.Identifier. name y))
151- unordered
161+ List. sort (fun (_ , x ) (_ , y ) -> compare_entry x.Tree. node y.node) unordered
152162 in
153163 let contents = ordered @ unordered |> List. map snd in
154164 { Tree. node = index; children = contents }
You can’t perform that action at this time.
0 commit comments