Skip to content

Commit

Permalink
Fix collation of subdirectories in HTML report (#401)
Browse files Browse the repository at this point in the history
Fixes #409.
  • Loading branch information
lukemaurer authored Apr 9, 2023
1 parent a19ce3b commit 54e6706
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/report/html.ml
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,25 @@ let output_html_index ~tree title theme filename files =
let directory', _ = split_filename name in
directory' = directory
in
let rec aux sub_dirs =
let rec aux sub_dirs sub_files =
function
[] -> (sub_dirs, [])
[] -> (List.rev sub_dirs, List.concat (List.rev sub_files))
| (name, _, _) as file :: files ->
match subdirectory_of ~directory name with
| None ->
let (sub_files, _) =
let (sub_files_here, files') =
Util.split
(fun (name, _, _) -> immediate_child_of ~directory name)
(file :: files)
in
(sub_dirs, sub_files)
aux sub_dirs (sub_files_here :: sub_files) files'
| Some root ->
let sub_dir, files' =
Util.split
(fun (name, _, _) -> subdirectory_of ~directory name = Some root)
(file :: files) in
aux ((root, sub_dir) :: sub_dirs) files'
in aux [] files
aux ((root, sub_dir) :: sub_dirs) sub_files files'
in aux [] [] files
in

let collate : index_file list -> index_element list * (int * int) =
Expand Down

0 comments on commit 54e6706

Please sign in to comment.