-
Notifications
You must be signed in to change notification settings - Fork 96
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6378ab9
Add test for text in referenced label (issue #941)
panglesd ac68726
Remember text for header label
panglesd 68848c4
Simplify signature for resolving references
panglesd 8df02f7
resolve reference should always render possible associated text
panglesd 098cfbb
Fix compatibility and runmdx tests
panglesd d062ec2
Added changelog entry for #1116
panglesd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} *) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{0 Page} | ||
|
||
{1:splice_me Splice me} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 aparagraph 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
byresolve_reference
, so there was some code inLink
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
toRef_tools.resolve_reference
so that the lookup of the title content is centralized in one place.Footnotes
paragraph
here is just a type alias forinline_element with_location list
. Not an actual paragraph. ↩