aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock.hs
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-06-26 22:41:07 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-06-30 22:37:49 +0200
commitd58bcf24dfa4333e7893935eb86c036be28125b1 (patch)
tree68a5c247d4944329041e97a07ebada46be3110b2 /haddock-api/src/Haddock.hs
parent844c09d0c1d724e0f0f0698654f2f85f5f58be19 (diff)
Make external hyperlinks point to locations specified by source URLs.
Diffstat (limited to 'haddock-api/src/Haddock.hs')
-rw-r--r--haddock-api/src/Haddock.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs
index 01e4cd45..3105edf5 100644
--- a/haddock-api/src/Haddock.hs
+++ b/haddock-api/src/Haddock.hs
@@ -264,7 +264,12 @@ render dflags flags qual ifaces installedIfaces srcMap = do
| Flag_HyperlinkedSource `elem` flags = Just defaultModuleSourceUrl
| otherwise = Nothing
- srcMap' = maybe srcMap (\path -> Map.insert pkgKey path srcMap) srcEntity
+ srcMap'
+ | Just srcNameUrl <- srcEntity = Map.insert pkgKey srcNameUrl srcMap
+ | Flag_HyperlinkedSource `elem` flags =
+ Map.insert pkgKey defaultNameSourceUrl srcMap
+ | otherwise = srcMap
+
-- TODO: Get these from the interface files as with srcMap
srcLMap' = maybe Map.empty (\path -> Map.singleton pkgKey path) srcLEntity
sourceUrls' = (srcBase, srcModule', srcMap', srcLMap')