Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use heading text for references to heading even across pages #1116

Merged
merged 6 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
--open (@jonludlam, #1104}
- Fix top comment not being taken from includes often enough (@panglesd, #1117)
- Fixed 404 links from search results (@panglesd, #1108)
- Fixed title content not being picked up across pages when rendering references
(#1116, @panglesd)


# 2.4.0
Expand Down
2 changes: 1 addition & 1 deletion src/odoc/url.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let resolve url_to_string directories reference =
Odoc_xref2.Errors.Tools_error.pp_reference_lookup_error e
in
Error (`Msg error)
| Ok resolved_reference -> (
| Ok (resolved_reference, _) -> (
let identifier =
Odoc_model.Paths.Reference.Resolved.identifier resolved_reference
in
Expand Down
16 changes: 6 additions & 10 deletions src/xref2/link.ml
Original file line number Diff line number Diff line change
Expand Up @@ -225,20 +225,16 @@ let rec comment_inline_element :
`Styled (s, List.map (with_location (comment_inline_element env)) ls)
| `Reference (r, content) as orig -> (
match Ref_tools.resolve_reference env r |> Error.raise_warnings with
| Ok x ->
| Ok (ref_, c) ->
let content =
(* In case of labels, use the heading text as reference text if
it's not specified. *)
match (content, x) with
| [], `Identifier ({ iv = #Id.Label.t_pv; _ } as i) -> (
match Env.lookup_by_id Env.s_label i env with
| Some (`Label (_, lbl)) ->
Odoc_model.Comment.link_content_of_inline_elements
lbl.Component.Label.text
| None -> [])
match (content, c) with
| [], Some content ->
Comment.link_content_of_inline_elements content
| content, _ -> content
in
`Reference (`Resolved x, content)
`Reference (`Resolved ref_, content)
| Error e ->
Errors.report ~what:(`Reference r) ~tools_error:(`Reference e)
`Resolve;
Expand Down Expand Up @@ -309,7 +305,7 @@ and comment_tag env parent ~loc:_ (x : Comment.tag) =
`Param (name, comment_nestable_block_element_list env parent content)
| `Raise ((`Reference (r, reference_content) as orig), content) -> (
match Ref_tools.resolve_reference env r |> Error.raise_warnings with
| Ok x ->
| Ok (x, _) ->
`Raise
( `Reference (`Resolved x, reference_content),
comment_nestable_block_element_list env parent content )
Expand Down
47 changes: 29 additions & 18 deletions src/xref2/ref_tools.ml
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ module L = struct

type t = Resolved.Label.t

let in_env env name : t ref_result =
env_lookup_by_name Env.s_label name env >>= fun (`Label (id, _)) ->
Ok (`Identifier id)
let in_env env name : (t * _) ref_result =
env_lookup_by_name Env.s_label name env >>= fun (`Label (id, lbl)) ->
Ok (`Identifier id, lbl.text)

let in_page _env (`P (_, p)) name =
let rec find = function
Expand All @@ -350,26 +350,29 @@ module L = struct
( _,
({ Odoc_model.Paths.Identifier.iv = `Label (_, name'); _ } as
label),
_ )
content )
when name = LabelName.to_string name' ->
Ok (`Identifier label)
Ok (`Identifier label, content)
| _ -> find tl)
| [] -> Error (`Find_by_name (`Page, name))
in
find p.Odoc_model.Lang.Page.content

let of_component _env ~parent_ref label =
Ok
(`Label
( (parent_ref :> Resolved.LabelParent.t),
Ident.Name.typed_label label.Component.Label.label ))
( `Label
( (parent_ref :> Resolved.LabelParent.t),
Ident.Name.typed_label label.Component.Label.label ),
label.text )

let in_label_parent env (parent : label_parent_lookup_result) name =
match parent with
| `S (p, _, sg) ->
| `S (p, _, sg) -> (
find_ambiguous ~kind:`Label Find.label_in_sig sg
(LabelName.to_string name)
>>= fun _ -> Ok (`Label ((p :> Resolved.LabelParent.t), name))
>>= function
| `FLabel lbl ->
Ok (`Label ((p :> Resolved.LabelParent.t), name), lbl.text))
| (`T _ | `C _ | `CT _) as r -> wrong_kind_error [ `S; `Page ] r
| `P _ as page -> in_page env page (LabelName.to_string name)
end
Expand Down Expand Up @@ -742,7 +745,9 @@ let resolve_class_signature_reference env (r : ClassSignature.t) =

(***)

let resolved1 r = Ok (r :> Resolved.t)
let resolved1 r = Ok ((r :> Resolved.t), None)

let resolved_with_text (r, txt) = Ok ((r :> Reference.Resolved.t), Some txt)

let resolved3 (r, _, _) = resolved1 r

Expand Down Expand Up @@ -772,7 +777,7 @@ let resolve_reference_dot_sg env ~parent_path ~parent_ref ~parent_sg name =
| `FClassType (name, ct) ->
CT.of_component env ct ~parent_ref name >>= resolved2
| `FValue (name, _) -> V.of_component env ~parent_ref name >>= resolved1
| `FLabel label -> L.of_component env ~parent_ref label >>= resolved1
| `FLabel label -> L.of_component env ~parent_ref label >>= resolved_with_text
| `FExn (name, _) -> EX.of_component env ~parent_ref name >>= resolved1
| `FExt _ -> EC.of_component env ~parent_ref name >>= resolved1
| `In_type (typ_name, _, r) -> (
Expand All @@ -784,7 +789,7 @@ let resolve_reference_dot_sg env ~parent_path ~parent_ref ~parent_sg name =
Error (`Find_by_name (`Any, name))

let resolve_reference_dot_page env page name =
L.in_page env page name >>= resolved1
L.in_page env page name >>= resolved_with_text

let resolve_reference_dot_type env ~parent_ref t name =
find Find.any_in_type t name >>= function
Expand Down Expand Up @@ -812,13 +817,19 @@ let resolve_reference =
fun env r ->
match r with
| `Root (name, `TUnknown) -> (
let identifier id = Ok (`Identifier (id :> Identifier.t)) in
let identifier ?text id = Ok (`Identifier (id :> Identifier.t), text) in
env_lookup_by_name Env.s_any name env >>= function
| `Module (_, _) as e -> resolved (M.of_element env e)
| `ModuleType (_, _) as e -> resolved (MT.of_element env e)
| `Value (id, _) -> identifier id
| `Type (id, _) -> identifier id
| `Label (id, _) -> identifier id
| `Label (id, _) ->
let text =
match Env.lookup_by_id Env.s_label id env with
| Some (`Label (_, lbl)) -> Some lbl.Component.Label.text
| None -> None
in
identifier ?text id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this last commit fix a bug?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interface for Ref_tools.resolve_reference was changed to also return a paragraph option: the "paragraph"1 is a possible replacement text computed when resolving the reference. In the case of a title, this "paragraph" is the title.

However, before the last commit, this paragraph was not always output as Some by resolve_reference, so there was some code in Link which looked for the title content in the missing case.

In short, the last commit does not fix a bug, it just moves this lookup of title content from Link.comment_inline_element to Ref_tools.resolve_reference so that the lookup of the title content is centralized in one place.

Footnotes

  1. paragraph here is just a type alias for inline_element with_location list. Not an actual paragraph.

| `Class (id, _) -> identifier id
| `ClassType (id, _) -> identifier id
| `Constructor (id, _) -> identifier id
Expand All @@ -827,7 +838,7 @@ let resolve_reference =
| `ExtensionDecl (id, _) -> identifier id
| `Field (id, _) -> identifier id
| `Page (id, _) -> identifier id)
| `Resolved r -> Ok r
| `Resolved r -> Ok (r, None)
| `Root (name, (`TModule | `TChildModule)) -> M.in_env env name >>= resolved
| `Module (parent, name) ->
resolve_signature_reference env parent >>= fun p ->
Expand All @@ -854,10 +865,10 @@ let resolve_reference =
| `Value (parent, name) ->
resolve_signature_reference env parent >>= fun p ->
V.in_signature env p name >>= resolved1
| `Root (name, `TLabel) -> L.in_env env name >>= resolved1
| `Root (name, `TLabel) -> L.in_env env name >>= resolved_with_text
| `Label (parent, name) ->
resolve_label_parent_reference env parent >>= fun p ->
L.in_label_parent env p name >>= resolved1
L.in_label_parent env p name >>= resolved_with_text
| `Root (name, (`TPage | `TChildPage)) -> Page.in_env env name >>= resolved2
| `Dot (parent, name) -> resolve_reference_dot env parent name
| `Root (name, `TConstructor) -> CS.in_env env name >>= resolved1
Expand Down
5 changes: 4 additions & 1 deletion src/xref2/ref_tools.mli
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ val resolve_module_reference :
module_lookup_result ref_result Odoc_model.Error.with_warnings

val resolve_reference :
Env.t -> t -> Resolved.t ref_result Odoc_model.Error.with_warnings
Env.t ->
t ->
(Resolved.t * Odoc_model.Comment.paragraph option) ref_result
Odoc_model.Error.with_warnings
14 changes: 7 additions & 7 deletions test/generators/html/Ocamlary.html
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,11 @@ <h4 id="emptySig"><a href="#emptySig" class="anchor"></a>EmptySig</h4>
</div>
</div>
<p>For a good time, see
<a href="Ocamlary-module-type-SuperSig-module-type-SubSigA.html#subSig">
<code>subSig</code>
<a href="Ocamlary-module-type-SuperSig-module-type-SubSigA.html#subSig"
title="subSig">A Labeled Section Header Inside of a Signature
</a> or
<a href="Ocamlary-module-type-SuperSig-module-type-SubSigB.html#subSig">
<code>subSig</code>
<a href="Ocamlary-module-type-SuperSig-module-type-SubSigB.html#subSig"
title="subSig">Another Labeled Section Header Inside of a Signature
</a> or
<a href="Ocamlary-module-type-SuperSig-module-type-EmptySig.html">
<code>SuperSig.EmptySig</code>
Expand Down Expand Up @@ -2796,12 +2796,12 @@ <h2 id="section-title-splicing">
</ul><p>But also to things in submodules:</p>
<ul>
<li><code>{!section:SuperSig.SubSigA.subSig}</code> :
<a href="Ocamlary-module-type-SuperSig-module-type-SubSigA.html#subSig">
<code>subSig</code>
<a href="Ocamlary-module-type-SuperSig-module-type-SubSigA.html#subSig"
title="subSig">A Labeled Section Header Inside of a Signature
</a>
</li>
<li><code>{!Aliases.incl}</code> :
<a href="Ocamlary-Aliases.html#incl"><code>incl</code></a>
<a href="Ocamlary-Aliases.html#incl" title="incl">include of Foo</a>
</li>
</ul><p>And just to make sure we do not mess up:</p>
<ul>
Expand Down
6 changes: 3 additions & 3 deletions test/generators/latex/Ocamlary.tex
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ \subsubsection{EmptySig\label{emptySig}}%
\ocamlcodefragment{\ocamltag{keyword}{end}}\\
\end{ocamlindent}%
\ocamlcodefragment{\ocamltag{keyword}{end}}\\
For a good time, see \hyperref[module-Ocamlary-module-type-SuperSig-module-type-SubSigA-subSig]{\ocamlinlinecode{\ocamlinlinecode{subSig}}[p\pageref*{module-Ocamlary-module-type-SuperSig-module-type-SubSigA-subSig}]} or \hyperref[module-Ocamlary-module-type-SuperSig-module-type-SubSigB-subSig]{\ocamlinlinecode{\ocamlinlinecode{subSig}}[p\pageref*{module-Ocamlary-module-type-SuperSig-module-type-SubSigB-subSig}]} or \hyperref[module-Ocamlary-module-type-SuperSig-module-type-EmptySig]{\ocamlinlinecode{\ocamlinlinecode{SuperSig.\allowbreak{}EmptySig}}[p\pageref*{module-Ocamlary-module-type-SuperSig-module-type-EmptySig}]}. Section \hyperref[module-Ocamlary-s9000]{\ocamlinlinecode{Section 9000}[p\pageref*{module-Ocamlary-s9000}]} is also interesting. \hyperref[module-Ocamlary-emptySig]{\ocamlinlinecode{EmptySig}[p\pageref*{module-Ocamlary-emptySig}]} is the section and \hyperref[module-Ocamlary-module-type-EmptySig]{\ocamlinlinecode{\ocamlinlinecode{EmptySig}}[p\pageref*{module-Ocamlary-module-type-EmptySig}]} is the module signature.
For a good time, see \hyperref[module-Ocamlary-module-type-SuperSig-module-type-SubSigA-subSig]{\ocamlinlinecode{A Labeled Section Header Inside of a Signature}[p\pageref*{module-Ocamlary-module-type-SuperSig-module-type-SubSigA-subSig}]} or \hyperref[module-Ocamlary-module-type-SuperSig-module-type-SubSigB-subSig]{\ocamlinlinecode{Another Labeled Section Header Inside of a Signature}[p\pageref*{module-Ocamlary-module-type-SuperSig-module-type-SubSigB-subSig}]} or \hyperref[module-Ocamlary-module-type-SuperSig-module-type-EmptySig]{\ocamlinlinecode{\ocamlinlinecode{SuperSig.\allowbreak{}EmptySig}}[p\pageref*{module-Ocamlary-module-type-SuperSig-module-type-EmptySig}]}. Section \hyperref[module-Ocamlary-s9000]{\ocamlinlinecode{Section 9000}[p\pageref*{module-Ocamlary-s9000}]} is also interesting. \hyperref[module-Ocamlary-emptySig]{\ocamlinlinecode{EmptySig}[p\pageref*{module-Ocamlary-emptySig}]} is the section and \hyperref[module-Ocamlary-module-type-EmptySig]{\ocamlinlinecode{\ocamlinlinecode{EmptySig}}[p\pageref*{module-Ocamlary-module-type-EmptySig}]} is the module signature.

\label{module-Ocamlary-module-Buffer}\ocamlcodefragment{\ocamltag{keyword}{module} \hyperref[module-Ocamlary-module-Buffer]{\ocamlinlinecode{Buffer}}}\ocamlcodefragment{ : \ocamltag{keyword}{sig}}\begin{ocamlindent}\label{module-Ocamlary-module-Buffer-val-f}\ocamlcodefragment{\ocamltag{keyword}{val} f : int \ocamltag{arrow}{$\rightarrow$} unit}\\
\end{ocamlindent}%
Expand Down Expand Up @@ -854,8 +854,8 @@ \subsection{Section title splicing\label{section-title-splicing}}%
\item{\ocamlinlinecode{\{!aliases\}} : \hyperref[module-Ocamlary-aliases]{\ocamlinlinecode{Aliases again}[p\pageref*{module-Ocamlary-aliases}]}}\end{itemize}%
But also to things in submodules:

\begin{itemize}\item{\ocamlinlinecode{\{!section:SuperSig.\allowbreak{}SubSigA.\allowbreak{}subSig\}} : \hyperref[module-Ocamlary-module-type-SuperSig-module-type-SubSigA-subSig]{\ocamlinlinecode{\ocamlinlinecode{subSig}}[p\pageref*{module-Ocamlary-module-type-SuperSig-module-type-SubSigA-subSig}]}}%
\item{\ocamlinlinecode{\{!Aliases.\allowbreak{}incl\}} : \hyperref[module-Ocamlary-module-Aliases-incl]{\ocamlinlinecode{\ocamlinlinecode{incl}}[p\pageref*{module-Ocamlary-module-Aliases-incl}]}}\end{itemize}%
\begin{itemize}\item{\ocamlinlinecode{\{!section:SuperSig.\allowbreak{}SubSigA.\allowbreak{}subSig\}} : \hyperref[module-Ocamlary-module-type-SuperSig-module-type-SubSigA-subSig]{\ocamlinlinecode{A Labeled Section Header Inside of a Signature}[p\pageref*{module-Ocamlary-module-type-SuperSig-module-type-SubSigA-subSig}]}}%
\item{\ocamlinlinecode{\{!Aliases.\allowbreak{}incl\}} : \hyperref[module-Ocamlary-module-Aliases-incl]{\ocamlinlinecode{include of Foo}[p\pageref*{module-Ocamlary-module-Aliases-incl}]}}\end{itemize}%
And just to make sure we do not mess up:

\begin{itemize}\item{\ocamlinlinecode{\{\{!section:indexmodules\}A\}} : \hyperref[module-Ocamlary-indexmodules]{\ocamlinlinecode{A}[p\pageref*{module-Ocamlary-indexmodules}]}}%
Expand Down
6 changes: 3 additions & 3 deletions test/generators/man/Ocamlary.3o
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ There's a signature in a module in this signature\.
\f[CB]end\fR
.sp
.fi
For a good time, see \f[CI]subSig\fR or \f[CI]subSig\fR or \f[CI]SuperSig\.EmptySig\fR\. Section \f[CI]Section 9000\fR is also interesting\. \f[CI]EmptySig\fR is the section and \f[CI]EmptySig\fR is the module signature\.
For a good time, see \f[CI]A Labeled Section Header Inside of a Signature\fR or \f[CI]Another Labeled Section Header Inside of a Signature\fR or \f[CI]SuperSig\.EmptySig\fR\. Section \f[CI]Section 9000\fR is also interesting\. \f[CI]EmptySig\fR is the section and \f[CI]EmptySig\fR is the module signature\.
.nf
.sp
\f[CB]module\fR Buffer : \f[CB]sig\fR \.\.\. \f[CB]end\fR
Expand Down Expand Up @@ -1811,9 +1811,9 @@ I can refer to
.sp
But also to things in submodules:
.sp
\(bu {!section:SuperSig\.SubSigA\.subSig} : \f[CI]subSig\fR
\(bu {!section:SuperSig\.SubSigA\.subSig} : \f[CI]A Labeled Section Header Inside of a Signature\fR
.br
\(bu {!Aliases\.incl} : \f[CI]incl\fR
\(bu {!Aliases\.incl} : \f[CI]include of Foo\fR
.sp
And just to make sure we do not mess up:
.sp
Expand Down
10 changes: 10 additions & 0 deletions test/xref2/label_reference_text.t/foo.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(* Why is there a normal comment here: The mli file should not be empty for
ocaml < 4.07 to pick the standalone comment. See
https://github.com/ocaml/ocaml/issues/7701 and
https://github.com/ocaml/ocaml/pull/1693 *)

(** {2:splice_me Splice me}
Should output only the heading's text:
{!splice_me}
{!Foo.splice_me}
{!page.splice_me} *)
3 changes: 3 additions & 0 deletions test/xref2/label_reference_text.t/page.mld
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{0 Page}

{1:splice_me Splice me}
27 changes: 27 additions & 0 deletions test/xref2/label_reference_text.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

A quick test to repro the issue found in #941

$ ocamlc -bin-annot -c foo.mli

$ odoc compile foo.cmti
$ odoc compile page.mld
$ odoc link -I . foo.odoc
$ odoc link -I . page-page.odoc

$ odoc html-generate --indent -o html/ foo.odocl
$ odoc html-generate --indent -o html/ page-page.odocl

The rendered html

$ cat html/Foo/index.html | grep "splice_me" -A 3
<nav class="odoc-toc"><ul><li><a href="#splice_me">Splice me</a></li></ul>
</nav>
<div class="odoc-content">
<h3 id="splice_me"><a href="#splice_me" class="anchor"></a>Splice me</h3>
<p>Should output only the heading's text:
<a href="#splice_me" title="splice_me">Splice me</a>
<a href="#splice_me" title="splice_me">Splice me</a>
<a href="../page.html#splice_me" title="splice_me">Splice me</a>
</p>
</div>
</body>
20 changes: 10 additions & 10 deletions test/xref2/labels/labels.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ We expect resolved references and the heading text filled in.

$ odoc_print test.odocl | jq -c '.. | .["`Reference"]? | select(.)'
[{"`Resolved":{"`Identifier":{"`Label":[{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Test"]},"N"]},"B"]}}},[{"`Word":"An"},"`Space",{"`Word":"other"},"`Space",{"`Word":"conflicting"},"`Space",{"`Word":"label"}]]
[{"`Resolved":{"`Label":[{"`Identifier":{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Test"]},"M"]}},"B"]}},[]]
[{"`Resolved":{"`Label":[{"`Identifier":{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Test"]},"M"]}},"B"]}},[{"`Word":"Potentially"},"`Space",{"`Word":"conflicting"},"`Space",{"`Word":"label"}]]
[{"`Resolved":{"`Identifier":{"`Label":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Test"]},"A"]}}},[{"`Word":"First"},"`Space",{"`Word":"label"}]]
[{"`Resolved":{"`Identifier":{"`Label":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Test"]},"B"]}}},[{"`Word":"Dupplicate"},"`Space",{"`Word":"B"}]]
[{"`Resolved":{"`Label":[{"`Identifier":{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Test"]},"M"]}},"C"]}},[]]
[{"`Resolved":{"`Label":[{"`Identifier":{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Test"]},"M"]}},"D"]}},[]]
[{"`Resolved":{"`Label":[{"`Identifier":{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Test"]},"M"]}},"B"]}},[]]
[{"`Resolved":{"`Label":[{"`Identifier":{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Test"]},"N"]}},"B"]}},[]]
[{"`Resolved":{"`Label":[{"`Identifier":{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Test"]},"M"]}},"C"]}},[{"`Word":"First"},"`Space",{"`Word":"label"},"`Space",{"`Word":"of"},"`Space",{"`Word":"M"}]]
[{"`Resolved":{"`Label":[{"`Identifier":{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Test"]},"M"]}},"D"]}},[{"`Word":"Floating"},"`Space",{"`Word":"label"},"`Space",{"`Word":"in"},"`Space",{"`Word":"M"}]]
[{"`Resolved":{"`Label":[{"`Identifier":{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Test"]},"M"]}},"B"]}},[{"`Word":"Potentially"},"`Space",{"`Word":"conflicting"},"`Space",{"`Word":"label"}]]
[{"`Resolved":{"`Label":[{"`Identifier":{"`Module":[{"`Root":[{"Some":{"`Page":["None","test"]}},"Test"]},"N"]}},"B"]}},[{"`Word":"An"},"`Space",{"`Word":"other"},"`Space",{"`Word":"conflicting"},"`Space",{"`Word":"label"}]]

$ odoc html-generate --indent -o html test.odocl

Expand Down Expand Up @@ -64,7 +64,7 @@ There are two references in N, one should point to a local label and the other t
<div class="odoc-content">
<h2 id="B"><a href="#B" class="anchor"></a>An other conflicting label</h2>
<p><a href="#B" title="B">An other conflicting label</a>
<a href="../M/index.html#B"><code>B</code></a>
<a href="../M/index.html#B" title="B">Potentially conflicting label</a>
</p>
</div>
</body>
Expand Down Expand Up @@ -127,10 +127,10 @@ The second occurence of 'B' in the main page should be disambiguated
<p>References to the labels:</p>
<p><a href="#A" title="A">First label</a>
<a href="#B" title="B">Dupplicate B</a>
<a href="M/index.html#C"><code>C</code></a>
<a href="M/index.html#D"><code>D</code></a>
<a href="M/index.html#B"><code>B</code></a>
<a href="N/index.html#B"><code>B</code></a>
<a href="M/index.html#C" title="C">First label of M</a>
<a href="M/index.html#D" title="D">Floating label in M</a>
<a href="M/index.html#B" title="B">Potentially conflicting label</a>
<a href="N/index.html#B" title="B">An other conflicting label</a>
</p>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion test/xref2/refs/refs.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let resolve_ref' env ref_str : ref =
| Error e ->
Format.kasprintf failwith "resolve_reference: %a"
Errors.Tools_error.pp_reference_lookup_error e
| Ok r -> r
| Ok (r, _) -> r

let resolve_ref_of_mli mli =
let sg = Common.signature_of_mli_string mli in
Expand Down
Loading