aboutsummaryrefslogtreecommitdiff
path: root/src/HaddockHtml.hs
diff options
context:
space:
mode:
authorpanne <unknown>2004-09-24 07:04:38 +0000
committerpanne <unknown>2004-09-24 07:04:38 +0000
commitc68b1ebac8ee20d0d0c453ca8e9ae642a4e9593a (patch)
treef3d1bfc4206d8d62b4434c25c140ad333e9feda8 /src/HaddockHtml.hs
parentc359e16a61b6385358b4d74a3b76651d1d32a703 (diff)
[haddock @ 2004-09-24 07:04:38 by panne]
Switched the default state for instances and the module hierarchy to non-collapsed. This can be reversed when we finally use cookies from JavaScript to have a more persistent state. Previously going back and forth in the documentation was simply too annoying because everything was collapsed again and therefore the documentation was not easily navigatable.
Diffstat (limited to 'src/HaddockHtml.hs')
-rw-r--r--src/HaddockHtml.hs19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/HaddockHtml.hs b/src/HaddockHtml.hs
index 17cab01e..07c33bee 100644
--- a/src/HaddockHtml.hs
+++ b/src/HaddockHtml.hs
@@ -303,7 +303,7 @@ mkNode ss (Node s leaf pkg short ts) id = htmlNode
genSubTree :: HtmlTable -> Int -> [ModuleTree] -> (Html,Int)
genSubTree htmlTable id [] = (sub_tree,id)
where
- sub_tree = vanillaTable ! [identifier id_s, thestyle "display:none;"] << htmlTable
+ sub_tree = collapsed vanillaTable id_s htmlTable
genSubTree htmlTable id (x:xs) = genSubTree (htmlTable </> u) id' xs
where
(u,id') = mkNode (s:ss) x id
@@ -664,7 +664,7 @@ ppHsDataDecl summary instances is_newty
| otherwise
= inst_hdr inst_id </>
tda [theclass "body"] <<
- collapsed inst_id (
+ collapsed thediv inst_id (
spacedTable1 << (
aboves (map (declBox.ppInstHead) instances)
)
@@ -843,7 +843,7 @@ ppHsClassDecl summary instances orig_c
| otherwise
= s8 </> inst_hdr inst_id </>
tda [theclass "body"] <<
- collapsed inst_id (
+ collapsed thediv inst_id (
spacedTable1 << (
aboves (map (declBox.ppInstHead) instances)
))
@@ -1168,13 +1168,18 @@ namedAnchor n = anchor ! [name (escapeStr n)]
--
-- A section of HTML which is collapsible via a +/- button.
--
+
+-- TODO: Currently the initial state is non-collapsed. Change the 'minusFile'
+-- below to a 'plusFile' and the 'display:block;' to a 'display:none;' when we
+-- use cookies from JavaScript to have a more persistent state.
+
collapsebutton :: String -> Html
collapsebutton id =
- image ! [ src plusFile, theclass "coll", onclick ("toggle(this,'" ++ id ++ "')"), alt "show/hide" ]
+ image ! [ src minusFile, theclass "coll", onclick ("toggle(this,'" ++ id ++ "')"), alt "show/hide" ]
-collapsed :: String -> Html -> Html
-collapsed id html =
- thediv ! [identifier id, thestyle "display:none;"] << html
+collapsed :: (HTML a) => (Html -> Html) -> String -> a -> Html
+collapsed fn id html =
+ fn ! [identifier id, thestyle "display:block;"] << html
-- A quote is a valid part of a Haskell identifier, but it would interfere with
-- the ECMA script string delimiter used in collapsebutton above.