let html_file oc line_count =
Printf.fprintf oc "%s"
"
\n\
\ \n";
Base.List.iter (l line_count) ~f:(fun i ->
Printf.fprintf oc "%d\n" i i i);
Printf.fprintf oc "%s" " | \n \n"
let html_file_end oc = Printf.fprintf oc "
|
\n"
let html_table oc (h : string list) (l : string list list) =
let render_row r =
Printf.fprintf oc "%s" "\n";
Base.List.iter r ~f:(fun e -> Printf.fprintf oc "%s | \n" e);
Printf.fprintf oc "%s" "
\n"
in
Printf.fprintf oc "%s" "\n";
Base.List.iter h ~f:(fun e -> Printf.fprintf oc "%s | \n" e);
Printf.fprintf oc "%s" "
\n";
Base.List.iter l ~f:(fun r -> render_row r);
Printf.fprintf oc "%s" "
\n"
let mk_file dir repo_name path =
let p = Printf.sprintf "%s/%s" dir path in
let fpath = Printf.sprintf "%s/tree/%s.html" repo_name path in
let ic = open_in p in
let oc = open_out fpath in
html_page oc repo_name repo_name;
(*let line_count = line_count ic in*)
html_file oc 100;
flush oc;
(*Stdio.In_channel.seek ic 0L;*)
let line_count = output_lines oc ic in
flush oc;
html_file_end oc;
flush oc;
html_page_end oc;
flush oc;
close_out oc;
close_in ic;
(*Stdio.Out_channel.(
with_file fpath ~f:(fun oc -> Stdio.Out_channel.fprintf oc "%s" fcontent));*)
line_count