package odoc
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
OCaml documentation generator
Install
dune-project
Dependency
Authors
Maintainers
Sources
odoc-2.1.1.tbz
sha256=f574dbd28cd0fc3a2b95525c4bb95ddf6d1f6408bb4fe12157fa537884f987fd
sha512=1c545c281a7022a167f028fff8cec6fb3f2f82da0881431be74e7a4281c5353ed83bfbdb4d9d9e08af6755dbe3505c052c5e5b58cdeb08c57aed5e89c0f15e91
doc/src/odoc.document/utils.ml.html
Source file utils.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45let option_of_result = function Result.Ok x -> Some x | Result.Error _ -> None let rec flatmap ?sep ~f = function | [] -> [] | [ x ] -> f x | x :: xs -> ( let hd = f x in let tl = flatmap ?sep ~f xs in match sep with None -> hd @ tl | Some sep -> hd @ sep @ tl) let rec skip_until ~p = function | [] -> [] | h :: t -> if p h then t else skip_until ~p t let split_at ~f lst = let rec loop acc = function | hd :: _ as rest when f hd -> (List.rev acc, rest) | [] -> (List.rev acc, []) | hd :: tl -> loop (hd :: acc) tl in loop [] lst let rec compute_length_source (t : Types.Source.t) : int = let f (acc : int) = function | Types.Source.Elt t -> acc + compute_length_inline t | Types.Source.Tag (_, t) -> acc + compute_length_source t in List.fold_left f 0 t and compute_length_inline (t : Types.Inline.t) : int = let f (acc : int) { Types.Inline.desc; _ } = match desc with | Text s -> acc + String.length s | Entity _e -> acc + 1 | Linebreak -> 0 (* TODO *) | Styled (_, t) | Link (_, t) | InternalLink (Resolved (_, t)) | InternalLink (Unresolved t) -> acc + compute_length_inline t | Source s -> acc + compute_length_source s | Raw_markup _ -> assert false (* TODO *) in List.fold_left f 0 t
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>