File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,11 +59,16 @@ let html_list_dir ~top ~parent d : string =
5959 Printf. bprintf body " <a href=\" /%s\" > (parent directory) </a>\n " p;
6060 end ;
6161 Printf. bprintf body " <ul>\n " ;
62+ let hidden_stop = ref 0 in
6263 Array. iteri
6364 (fun i f ->
6465 if is_hidden f && (i= 0 || not (is_hidden entries.(i-1 ))) then (
65- Printf. bprintf body " <details> <summary>(hidden files)</summary>\n " ;
66- ) else if not (is_hidden f) && i> 0 && is_hidden entries.(i-1 ) then (
66+ hidden_stop := i;
67+ while ! hidden_stop < Array. length entries && is_hidden entries.(! hidden_stop) do
68+ incr hidden_stop;
69+ done ;
70+ Printf. bprintf body " <details> <summary>(%d hidden files)</summary>\n " (! hidden_stop- i);
71+ ) else if i = ! hidden_stop then (
6772 Printf. bprintf body " </details/>\n " ;
6873 );
6974 if not @@ contains_dot_dot (d // f) then (
You can’t perform that action at this time.
0 commit comments