summaryrefslogtreecommitdiff
path: root/lib/helpers/html_helpers.ml
blob: da5addcd5addaaf5ce8b568444140dce2489306c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(* Helper function to generate links for repositories *)
let generate_repo_links () =
  let git_dir = Filename.concat (Unix.getenv "HOME") "git" in
  if Sys.file_exists git_dir && Sys.is_directory git_dir then
    Sys.readdir git_dir
    |> Array.to_list
    |> List.map (fun repo -> Printf.sprintf "<li><a href='/%s/tree'>%s</a></li>" repo repo)
    |> String.concat ""
  else
    "<li>Error: '~/git' directory not found.</li>"

(* Page layout function *)
let page_layout ~content =
  "<html><body>"
  ^ Layouts.Header.header ()
  ^ Layouts.Topnav.topnav ()
  ^ "<main>" ^ content ^ "</main>"
  ^ "</body></html>"
Copyright 2019--2025 Marius PETER