Skip to content

Commit

Permalink
Add clarifying comment for search links
Browse files Browse the repository at this point in the history
Signed-off-by: Paul-Elliot <[email protected]>
  • Loading branch information
panglesd authored and jonludlam committed May 3, 2024
1 parent 75c2367 commit b7b3984
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/search/html.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@ open Lang

let url { Entry.id; kind; doc = _ } =
let open Entry in
let stop_before = match kind with Doc _ -> false | _ -> true in
let stop_before =
(* Some module/module types/... might not have an expansion, so we need to
be careful and set [stop_before] to [true] for those kind of search
entries, to avoid linking to an inexistant page.
Docstring do not have an ID in the model, and use the ID from the parent
signature in search entries. Therefore, links to doc comments need
[stop_before] to be [false] to point to the page where they are present.
Values, types, ... are not sensitive to [stop_before], allowing us to
shorten the match. *)
match kind with Doc _ -> false | _ -> true
in
match Odoc_document.Url.from_identifier ~stop_before id with
| Ok url ->
let config =
Expand Down

0 comments on commit b7b3984

Please sign in to comment.