Skip to content

Commit b7b3984

Browse files
panglesdjonludlam
authored andcommitted
Add clarifying comment for search links
Signed-off-by: Paul-Elliot <peada@free.fr>
1 parent 75c2367 commit b7b3984

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/search/html.ml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,19 @@ open Lang
55

66
let url { Entry.id; kind; doc = _ } =
77
let open Entry in
8-
let stop_before = match kind with Doc _ -> false | _ -> true in
8+
let stop_before =
9+
(* Some module/module types/... might not have an expansion, so we need to
10+
be careful and set [stop_before] to [true] for those kind of search
11+
entries, to avoid linking to an inexistant page.
12+
13+
Docstring do not have an ID in the model, and use the ID from the parent
14+
signature in search entries. Therefore, links to doc comments need
15+
[stop_before] to be [false] to point to the page where they are present.
16+
17+
Values, types, ... are not sensitive to [stop_before], allowing us to
18+
shorten the match. *)
19+
match kind with Doc _ -> false | _ -> true
20+
in
921
match Odoc_document.Url.from_identifier ~stop_before id with
1022
| Ok url ->
1123
let config =

0 commit comments

Comments
 (0)