From f0a5efd72072b37a2150efd281eb158033e67585 Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Tue, 28 Jul 2015 23:34:03 +0200 Subject: Split instance subsection layout method to top-level declarations. --- haddock-api/src/Haddock/Backends/Xhtml/Layout.hs | 27 +++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (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 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 -- cgit v1.2.3