this repo has no description
at main 28 lines 941 B view raw
1open Odoc_document 2 3let for_printing url = List.map snd @@ Url.Path.to_list url 4 5let segment_to_string (kind, name) = 6 Format.asprintf "%a%s" Url.Path.pp_disambiguating_prefix kind name 7 8let as_filename ?(add_ext = true) (url : Url.Path.t) = 9 let components = Url.Path.to_list url in 10 let dir, path = 11 Url.Path.split 12 ~is_dir:(function `Page -> `IfNotLast | _ -> `Never) 13 components 14 in 15 let dir = List.map segment_to_string dir in 16 let path = String.concat "." (List.map segment_to_string path) in 17 let str_path = String.concat Fpath.dir_sep (dir @ [ path ]) in 18 if add_ext then Fpath.(v str_path + ".3o") else Fpath.v str_path 19 20let rec is_class_or_module_path (url : Url.Path.t) = 21 match url.kind with 22 | `Module | `LeafPage | `Page | `Class -> ( 23 match url.parent with 24 | None -> true 25 | Some url -> is_class_or_module_path url) 26 | _ -> false 27 28let should_inline x = not @@ is_class_or_module_path x