diff options
| author | idontgetoutmuch <dominic@steinitz.org> | 2015-12-20 21:01:47 +0000 | 
|---|---|---|
| committer | idontgetoutmuch <dominic@steinitz.org> | 2015-12-20 21:01:47 +0000 | 
| commit | 2bdfda1fb2e0de696ca8c6f7a152b2f85a541be9 (patch) | |
| tree | cc29895f7d69f051cfec172bb0f8c2ef03552789 /haddock-api/src/Haddock/Backends/Xhtml/Names.hs | |
| parent | 5a57a24c44e06e964c4ea2276c842c722c4e93d9 (diff) | |
| parent | fa03f80d76f1511a811a0209ea7a6a8b6c58704f (diff) | |
Merge pull request #1 from haskell/ghc-head
Ghc head
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Xhtml/Names.hs')
| -rw-r--r-- | haddock-api/src/Haddock/Backends/Xhtml/Names.hs | 21 | 
1 files changed, 13 insertions, 8 deletions
| diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Names.hs b/haddock-api/src/Haddock/Backends/Xhtml/Names.hs index cf12da40..c69710d1 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Names.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Names.hs @@ -110,16 +110,21 @@ ppName notation name = wrapInfix notation (getOccName name) $ toHtml (getOccStri  ppBinder :: Bool -> OccName -> Html --- The Bool indicates whether we are generating the summary, in which case --- the binder will be a link to the full definition. -ppBinder True n = linkedAnchor (nameAnchorId n) << ppBinder' Prefix n -ppBinder False n = namedAnchor (nameAnchorId n) ! [theclass "def"] -                        << ppBinder' Prefix n +ppBinder = ppBinderWith Prefix  ppBinderInfix :: Bool -> OccName -> Html -ppBinderInfix True n = linkedAnchor (nameAnchorId n) << ppBinder' Infix n -ppBinderInfix False n = namedAnchor (nameAnchorId n) ! [theclass "def"] -                             << ppBinder' Infix n +ppBinderInfix = ppBinderWith Infix + +ppBinderWith :: Notation -> Bool -> OccName -> Html +-- 'isRef' indicates whether this is merely a reference from another part of +-- the documentation or is the actual definition; in the latter case, we also +-- set the 'id' and 'class' attributes. +ppBinderWith notation isRef n = +  linkedAnchor name ! attributes << ppBinder' notation n +  where +    name = nameAnchorId n +    attributes | isRef     = [] +               | otherwise = [identifier name, theclass "def"]  ppBinder' :: Notation -> OccName -> Html  ppBinder' notation n = wrapInfix notation n $ ppOccName n | 
