diff options
author | Alec Theriault <alec.theriault@gmail.com> | 2018-02-11 03:29:56 -0800 |
---|---|---|
committer | Alexander Biehl <alexbiehl@gmail.com> | 2018-02-11 12:29:56 +0100 |
commit | 0bffd8bd1105331a6fcf0b7e592358c131de9300 (patch) | |
tree | e9847a5b3a83a7dc166bfed10bf6b3e1f66c3817 /haddock-api/src | |
parent | 4b4733a05c7bf35d98ed82f2a62d4771db1fb788 (diff) |
Add module tooltips to linked identifiers (#753)
No more clicking to figure out whether your bytestring is strict or lazy!
Diffstat (limited to 'haddock-api/src')
-rw-r--r-- | haddock-api/src/Haddock/Backends/Xhtml/Names.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Names.hs b/haddock-api/src/Haddock/Backends/Xhtml/Names.hs index a84a55e8..574045e0 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Names.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Names.hs @@ -22,7 +22,7 @@ import Haddock.GhcUtils import Haddock.Types import Haddock.Utils -import Text.XHtml hiding ( name, title, p, quote ) +import Text.XHtml hiding ( name, p, quote ) import qualified Data.Map as M import qualified Data.List as List @@ -147,17 +147,19 @@ linkId mdl mbName = linkIdOcc mdl (fmap nameOccName mbName) True linkIdOcc :: Module -> Maybe OccName -> Bool -> Html -> Html linkIdOcc mdl mbName insertAnchors = if insertAnchors - then anchor ! [href url] + then anchor ! [href url, title ttl] else id where + ttl = moduleNameString (moduleName mdl) url = case mbName of Nothing -> moduleUrl mdl Just name -> moduleNameUrl mdl name linkIdOcc' :: ModuleName -> Maybe OccName -> Html -> Html -linkIdOcc' mdl mbName = anchor ! [href url] +linkIdOcc' mdl mbName = anchor ! [href url, title ttl] where + ttl = moduleNameString mdl url = case mbName of Nothing -> moduleHtmlFile' mdl Just name -> moduleNameUrl' mdl name |