Commit 98d6ca75 authored by Loïc Correnson's avatar Loïc Correnson
Browse files

[server] sort index entries by category

parent 144f8dda
......@@ -125,23 +125,11 @@ let index () =
(fun (title,entry) -> Markdown.href ~text:(plain title) entry)
(List.sort
(fun (e1, _) (e2, _) ->
let entry_path_and_name e =
match String.split_on_char '.' e with
| category :: subcategory :: [ name ] ->
Some (Format.sprintf "%s.%s" category subcategory), name
| category :: [ name ] ->
Some category, name
| _ ->
None, e
in
match entry_path_and_name e1, entry_path_and_name e2 with
| (Some p1, n1), (Some p2, n2) ->
let c = String.compare p1 p2 in
if c = 0
then String.compare n1 n2
else c
| _ ->
String.compare e1 e2)
let entry e =
match List.rev (String.split_on_char '.' e) with
| [] -> [],e
| a::rpath -> List.rev rpath , a
in Pervasives.compare (entry e1) (entry e2))
!entries)
let link ~toc ~title ~href : json =
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment