diff options
author | Ćukasz Hanuszczak <lukasz.hanuszczak@gmail.com> | 2015-07-15 14:27:28 +0200 |
---|---|---|
committer | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2015-08-21 18:22:30 +0100 |
commit | 05f35d7defbf702e27211628e26a738fa97ecde8 (patch) | |
tree | e1f428f13988cc9b237c23196f1f0254933b847a /haddock-api/src/Haddock/Backends/Xhtml/Layout.hs | |
parent | 2070c0fa9354365e3e672f5cbee2e04d0ef1fd02 (diff) |
Add expandable method section for each class instance declaration.
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Xhtml/Layout.hs')
-rw-r--r-- | haddock-api/src/Haddock/Backends/Xhtml/Layout.hs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs index 4714c1b6..188b4243 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs @@ -31,7 +31,7 @@ module Haddock.Backends.Xhtml.Layout ( subConstructors, subEquations, subFields, - subInstances, + subInstances, subClsInstance, subMethods, subMinimal, @@ -200,6 +200,20 @@ subInstances qual nm lnks splice = maybe noHtml wrap . instTable subCaption = paragraph ! collapseControl id_ True "caption" << "Instances" id_ = makeAnchorId $ "i:" ++ nm + +-- | Generate class instance div with specialized methods. +subClsInstance :: String -- ^ Section unique id + -> Html -- ^ Header contents (instance name and type) + -> [Html] -- ^ Method contents (pretty-printed signatures) + -> Html +subClsInstance sid hdr mets = + hdrDiv <+> methodDiv + where + anchorId = makeAnchorId $ "i:" ++ sid + hdrDiv = thediv ! collapseControl anchorId False "instance" << hdr + methodDiv = thediv ! collapseSection anchorId False [] << subMethods mets + + subMethods :: [Html] -> Html subMethods = divSubDecls "methods" "Methods" . subBlock |