let url_of_module_path ~configuration code =
let is_value v =
match v.[0] with
| None -> false
| Some c when Char.lowercase c = c -> true
| Some c -> false in
let rec loop acc =
function
| [] -> ""
| ["t"] -> acc ^ "html#TYPEt"
| [one] when is_value one -> acc ^ "html#VAL" ^ one
| [one] -> acc ^ one ^ ".html"
| modul :: more -> loop (acc ^ modul ^ ".") more
in
let prefix =
List.find_map configuration#catch_module_paths ~f:(fun (_, re, pr) ->
if Re.execp re code then Some pr else None)
|> Option.value ~default:"" in
loop ("api/" ^ prefix) (String.split code ~on:(`Character '.'))