This repository was archived by the owner on Aug 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 236
Fix hyperlinks to external items and modules #1482
Merged
Merged
Conversation
This file contains hidden or 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
Fixes haskell#1481. There were two bugs in this: * We were assuming that we were always getting a relative path to the module in question, while Nix gives us file:// URLs sometimes. This change checks for those and stops prepending `..` to them. * We were not linking to the file under the module. This seems to have been a regression introduced by haskell#977. That is, the URLs were going to something like file:///nix/store/3bwbsy0llxxn1pixx3ll02alln56ivxy-ghc-9.0.2-doc/share/doc/ghc/html/libraries/base-4.15.1.0/src which does not have the appropriate HTML file or fragment for the item in question at the end. There is a remaining instance of the latter bug, but not in the hyperlinker: the source links to items reexported from other modules are also not including the correct file name. e.g. the reexport of Entity in esqueleto, from persistent. NOTE: This needs to get tested with relative-path located modules. It seems correct for Nix based on my testing. Testing strategy: ``` nix-shell '<nixpkgs>' --pure -A haskell.packages.ghc922.aeson mkdir /tmp/aesonbuild && cd /tmp/aesonbuild export out=/tmp/aesonbuild/out genericBuild ln -sf $HOME/co/haddock/haddock-api/resources . ./Setup haddock --with-haddock=$HOME/path/to/haddock/exec --hyperlink-source ```
Kleidukos
approved these changes
May 7, 2022
lf-
added a commit
to lf-/nixpkgs
that referenced
this pull request
Jun 16, 2022
This was disabled basically by accident before. The links are jacked, but that was is true for every package; it is not unique to this PR. I fixed it upstream here: haskell/haddock#1482 but it's not in any release distributions yet I don't think. Fixes NixOS#171841
This was referenced Jun 16, 2022
@Kleidukos does anything need to be done on my end to get this forward-ported to ghc-9.4? |
I'm on it. :) |
@lf- There will be no problem for ghc-9.4. |
@Kleidukos This doesn't seem to be in GHC 9.4.1-rc1, since the patch we add in nixpkgs still applies?! Is that accurate or is something else wrong? |
@sternenseemann From my interactions with the GHC release team, there will be a release of Haddock bundled with GHC 9.4.1 |
(note that this probably will also mark the move of Haddock to the GHC tree) |
Maybe it's wise to follow up? Currently |
duog
pushed a commit
to duog/haddock
that referenced
this pull request
Jul 29, 2022
Fixes haskell#1481. There were two bugs in this: * We were assuming that we were always getting a relative path to the module in question, while Nix gives us file:// URLs sometimes. This change checks for those and stops prepending `..` to them. * We were not linking to the file under the module. This seems to have been a regression introduced by haskell#977. That is, the URLs were going to something like file:///nix/store/3bwbsy0llxxn1pixx3ll02alln56ivxy-ghc-9.0.2-doc/share/doc/ghc/html/libraries/base-4.15.1.0/src which does not have the appropriate HTML file or fragment for the item in question at the end. There is a remaining instance of the latter bug, but not in the hyperlinker: the source links to items reexported from other modules are also not including the correct file name. e.g. the reexport of Entity in esqueleto, from persistent. NOTE: This needs to get tested with relative-path located modules. It seems correct for Nix based on my testing. Testing strategy: ``` nix-shell '<nixpkgs>' --pure -A haskell.packages.ghc922.aeson mkdir /tmp/aesonbuild && cd /tmp/aesonbuild export out=/tmp/aesonbuild/out genericBuild ln -sf $HOME/co/haddock/haddock-api/resources . ./Setup haddock --with-haddock=$HOME/path/to/haddock/exec --hyperlink-source ``` (cherry picked from commit ab53ccf)
Kleidukos
added a commit
that referenced
this pull request
Jul 29, 2022
Backport 9-4: Fix hyperlinks to external items and modules (#1482)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #1481.
There were two bugs in this:
module in question, while Nix gives us file:// URLs sometimes. This
change checks for those and stops prepending
..
to them.to have been a regression introduced by Use
.hie
files for the Hyperlinker backend #977. That is, the URLs weregoing to something like
file:///nix/store/3bwbsy0llxxn1pixx3ll02alln56ivxy-ghc-9.0.2-doc/share/doc/ghc/html/libraries/base-4.15.1.0/src
which does not have the appropriate HTML file or fragment for the item
in question at the end.
There is a remaining instance of the latter bug, but not in the
hyperlinker: the source links to items reexported from other modules are
also not including the correct file name. e.g. the reexport of Entity in
esqueleto, from persistent has a source link
file:///nix/store/jwrrwxbkr2pcpf4kjgd3zyalf6jakxkz-persistent-2.13.3.5-doc/share/doc/persistent-2.13.3.5/html/src
. This bug is probably somewhere around here: https://github.com/haskell/haddock/blob/ghc-9.2/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs#L289-L293NOTE: This needs to get tested with relative-path located modules. It seems
correct for Nix based on my testing.
Testing strategy: