From 05f35d7defbf702e27211628e26a738fa97ecde8 Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Wed, 15 Jul 2015 14:27:28 +0200 Subject: Add expandable method section for each class instance declaration. --- haddock-api/src/Haddock/Backends/Xhtml/Layout.hs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'haddock-api/src/Haddock/Backends/Xhtml/Layout.hs') 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 -- cgit v1.2.3