aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2011-11-26 22:10:28 +0100
committerDavid Waern <david.waern@gmail.com>2011-11-26 22:10:28 +0100
commit07c816c5e548824bb089442cf32d70682e47200b (patch)
tree5300bfd77bd12fbbfbf604844057d43f2d22eec6
parent638683cbe3d68427273ad71eeb8f704e165952fa (diff)
Fix module reference bug.
-rw-r--r--src/Haddock/Backends/Xhtml/DocMarkup.hs3
-rw-r--r--src/Haddock/Backends/Xhtml/Names.hs6
-rw-r--r--src/Haddock/GhcUtils.hs4
-rw-r--r--tests/html-tests/tests/B.hs1
-rw-r--r--tests/html-tests/tests/B.html.ref3
5 files changed, 8 insertions, 9 deletions
diff --git a/src/Haddock/Backends/Xhtml/DocMarkup.hs b/src/Haddock/Backends/Xhtml/DocMarkup.hs
index 87d67b76..f506d2b8 100644
--- a/src/Haddock/Backends/Xhtml/DocMarkup.hs
+++ b/src/Haddock/Backends/Xhtml/DocMarkup.hs
@@ -21,7 +21,6 @@ module Haddock.Backends.Xhtml.DocMarkup (
import Haddock.Backends.Xhtml.Names
import Haddock.Backends.Xhtml.Utils
-import Haddock.GhcUtils
import Haddock.Types
import Haddock.Utils
@@ -39,7 +38,7 @@ parHtmlMarkup qual ppId = Markup {
markupIdentifier = thecode . ppId,
markupIdentifierUnchecked = thecode . ppUncheckedLink qual,
markupModule = \m -> let (mdl,ref) = break (=='#') m
- in ppModuleRef (mkModuleNoPackage mdl) ref,
+ in ppModuleRef (mkModuleName mdl) ref,
markupEmphasis = emphasize,
markupMonospaced = thecode,
markupUnorderedList = unordList,
diff --git a/src/Haddock/Backends/Xhtml/Names.hs b/src/Haddock/Backends/Xhtml/Names.hs
index 19efea2e..7c2375cf 100644
--- a/src/Haddock/Backends/Xhtml/Names.hs
+++ b/src/Haddock/Backends/Xhtml/Names.hs
@@ -127,9 +127,9 @@ ppModule mdl = anchor ! [href (moduleUrl mdl)]
<< toHtml (moduleString mdl)
-ppModuleRef :: Module -> String -> Html
-ppModuleRef mdl ref = anchor ! [href (moduleUrl mdl ++ ref)]
- << toHtml (moduleString mdl)
+ppModuleRef :: ModuleName -> String -> Html
+ppModuleRef mdl ref = anchor ! [href (moduleHtmlFile' mdl ++ ref)]
+ << toHtml (moduleNameString mdl)
-- NB: The ref parameter already includes the '#'.
-- This function is only called from markupModule expanding a
-- DocModule, which doesn't seem to be ever be used.
diff --git a/src/Haddock/GhcUtils.hs b/src/Haddock/GhcUtils.hs
index 6d170586..2fb8c8a3 100644
--- a/src/Haddock/GhcUtils.hs
+++ b/src/Haddock/GhcUtils.hs
@@ -61,10 +61,6 @@ unpackPackageId p
where str = packageIdString p
-mkModuleNoPackage :: String -> Module
-mkModuleNoPackage str = mkModule (stringToPackageId "") (mkModuleName str)
-
-
lookupLoadedHomeModuleGRE :: GhcMonad m => ModuleName -> m (Maybe GlobalRdrEnv)
lookupLoadedHomeModuleGRE mod_name = withSession $ \hsc_env ->
case lookupUFM (hsc_HPT hsc_env) mod_name of
diff --git a/tests/html-tests/tests/B.hs b/tests/html-tests/tests/B.hs
index 38310ebd..28cda4a0 100644
--- a/tests/html-tests/tests/B.hs
+++ b/tests/html-tests/tests/B.hs
@@ -3,5 +3,6 @@ import A ( A(..), test2 )
-- | This link shouldn't work: 'other'.
-- These links should work: 'A.other', 'Data.List.sortBy', 'test2', 'A.test2', 'Data.Maybe.fromMaybe'.
+-- Module link: "Prelude".
test :: Int
test = 1
diff --git a/tests/html-tests/tests/B.html.ref b/tests/html-tests/tests/B.html.ref
index f81460ed..7f5d5354 100644
--- a/tests/html-tests/tests/B.html.ref
+++ b/tests/html-tests/tests/B.html.ref
@@ -99,6 +99,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_B.html");};
>fromMaybe</a
></code
>.
+ Module link: <a href=""
+ >Prelude</a
+ >.
</p
></div
></div