Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

Backport 9-4: Fix hyperlinks to external items and modules (#1482) #1516

Merged
merged 1 commit into from
Jul 29, 2022

Conversation

duog
Copy link
Contributor

@duog duog commented Jul 29, 2022

for #1507

(cherry picked from commit ab53ccf)

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 Kleidukos merged commit 7484cf8 into haskell:ghc-9.4 Jul 29, 2022
hubot pushed a commit to ghc/ghc that referenced this pull request May 17, 2024
…perlinks

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.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants