aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorƁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-07-28 23:34:03 +0200
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2015-08-21 18:22:32 +0100
commitf0a5efd72072b37a2150efd281eb158033e67585 (patch)
treec07eca726ff11e61885b84d67481a784f949281c
parentfb62902d37e9467364bbbafc9e06128be89a7277 (diff)
Split instance subsection layout method to top-level declarations.
-rw-r--r--haddock-api/src/Haddock/Backends/Xhtml/Layout.hs27
1 files changed, 22 insertions, 5 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
index 460cc6d7..da03985e 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
@@ -206,12 +206,29 @@ subClsInstance :: String -- ^ Section unique id
-> Html -- ^ Header contents (instance name and type)
-> [Html] -- ^ Method contents (pretty-printed signatures)
-> Html
-subClsInstance sid hdr mets =
- (hdrDiv << hdr) <+> (methodDiv << subBlock mets)
+subClsInstance iid hdr mets = subInstHead iid hdr <+> subInstMethods iid mets
+
+
+subInstHead :: String -- ^ Instance unique id (for anchor generation)
+ -> Html -- ^ Header content (instance name and type)
+ -> Html
+subInstHead iid hdr =
+ expander << hdr
where
- anchorId = makeAnchorId $ "i:" ++ sid
- hdrDiv = thediv ! collapseControl anchorId False "instance"
- methodDiv = thediv ! collapseSection anchorId False "methods"
+ expander = thediv ! collapseControl (instAnchorId iid) False "instance"
+
+
+subInstMethods :: String -- ^ Instance unique id (for anchor generation)
+ -> [Html] -- ^ Method contents (pretty-printed signatures)
+ -> Html
+subInstMethods iid mets =
+ section << subBlock mets
+ where
+ section = thediv ! collapseSection (instAnchorId iid) False "methods"
+
+
+instAnchorId :: String -> String
+instAnchorId iid = makeAnchorId $ "i:" ++ iid
subMethods :: [Html] -> Html