Skip to content
Snippets Groups Projects
Commit 93fce46b authored by Zubin's avatar Zubin
Browse files

haddock: Fix hyperlinker source urls (#24907)

This fixes a bug introduced by f56838c36235febb224107fa62334ebfe9941aba Links to
external modules in the hyperlinker are uniformly generated using splicing the
template given to us instead of attempting to construct the url in an ad-hoc manner.
parent 915625ca
No related branches found
No related tags found
No related merge requests found
......@@ -275,7 +275,7 @@ hyperlink (srcs, srcs') ident = case ident of
Html.anchor content
! [Html.href $ hypSrcModuleNameUrl mdl name]
Just (SrcExternal path) ->
let hyperlinkUrl = makeHyperlinkUrl path </> hypSrcModuleNameUrl mdl name
let hyperlinkUrl = hypSrcModuleUrlToNameFormat $ makeHyperlinkUrl path
in Html.anchor content
! [Html.href $ spliceURL (Just mdl) (Just name) Nothing hyperlinkUrl]
Nothing -> content
......@@ -288,7 +288,7 @@ hyperlink (srcs, srcs') ident = case ident of
Html.anchor content
! [Html.href $ hypSrcModuleUrl' moduleName]
Just (SrcExternal path) ->
let hyperlinkUrl = makeHyperlinkUrl path </> hypSrcModuleUrl' moduleName
let hyperlinkUrl = makeHyperlinkUrl path
in Html.anchor content
! [Html.href $ spliceURL' (Just moduleName) Nothing Nothing hyperlinkUrl]
Nothing -> content
......
......@@ -13,6 +13,7 @@ module Haddock.Backends.Hyperlinker.Utils
, hypSrcModuleUrlFormat
, hypSrcModuleNameUrlFormat
, hypSrcModuleLineUrlFormat
, hypSrcModuleUrlToNameFormat
, spliceURL
, spliceURL'
......@@ -82,6 +83,9 @@ hypSrcModuleNameUrlFormat = hypSrcModuleUrlFormat ++ "#" ++ nameFormat
hypSrcModuleLineUrlFormat :: String
hypSrcModuleLineUrlFormat = hypSrcModuleUrlFormat ++ "#" ++ lineFormat
hypSrcModuleUrlToNameFormat :: String -> String
hypSrcModuleUrlToNameFormat url = url ++ "#" ++ nameFormat
moduleFormat :: String
moduleFormat = "%{MODULE}.html"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment