diff options
author | Ćukasz Hanuszczak <lukasz.hanuszczak@gmail.com> | 2015-07-28 23:34:03 +0200 |
---|---|---|
committer | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2015-08-21 18:22:32 +0100 |
commit | f0a5efd72072b37a2150efd281eb158033e67585 (patch) | |
tree | c07eca726ff11e61885b84d67481a784f949281c /haddock-api/src/Haddock/Backends | |
parent | fb62902d37e9467364bbbafc9e06128be89a7277 (diff) |
Split instance subsection layout method to top-level declarations.
Diffstat (limited to 'haddock-api/src/Haddock/Backends')
-rw-r--r-- | haddock-api/src/Haddock/Backends/Xhtml/Layout.hs | 27 |
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 |