aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html/xhaddock.css14
-rw-r--r--src/Haddock/Backends/Xhtml/Layout.hs20
2 files changed, 27 insertions, 7 deletions
diff --git a/html/xhaddock.css b/html/xhaddock.css
index fc305af3..ae2d2121 100644
--- a/html/xhaddock.css
+++ b/html/xhaddock.css
@@ -204,9 +204,6 @@ div.top h5 {
margin-left: 10px;
}
-div.top table, div.subdecl {
- margin-left: 20px;
-}
.src {
padding: 3px;
@@ -253,6 +250,17 @@ div.subs {
margin-top: 2px;
}
+.subs table {
+ margin-left: 10px;
+ border-spacing: 1px 1px;
+ margin-top: 4px;
+ margin-bottom: 4px;
+}
+
+.subs table table {
+ margin-left: 0;
+}
+
.fields .caption {
display: none;
}
diff --git a/src/Haddock/Backends/Xhtml/Layout.hs b/src/Haddock/Backends/Xhtml/Layout.hs
index 80dd5ec8..3c695042 100644
--- a/src/Haddock/Backends/Xhtml/Layout.hs
+++ b/src/Haddock/Backends/Xhtml/Layout.hs
@@ -80,17 +80,29 @@ subDlist :: [SubDecl] -> Maybe Html
subDlist [] = Nothing
subDlist decls = Just $ dlist << map subEntry decls
where
- subEntry (decl, mdoc, subs) = Just $
+ subEntry (decl, mdoc, subs) =
dterm ! [theclass "src"] << decl
- +++ ddef << (fmap docToHtml mdoc `with` subs)
+ +++
+ ddef << (fmap docToHtml mdoc `with` subs)
+
Nothing `with` [] = spaceHtml
ma `with` bs = ma +++ bs
+subTable :: [SubDecl] -> Maybe Html
+subTable [] = Nothing
+subTable decls = Just $ table << aboves (concatMap subRow decls)
+ where
+ subRow (decl, mdoc, subs) =
+ (td ! [theclass "src"] << decl
+ <->
+ td << nonEmpty (fmap docToHtml mdoc))
+ : map (cell . (td <<)) subs
+
subConstructors :: [(Html, Maybe (Doc DocName), [Html])] -> Html
-subConstructors = divSubDecls "constructors" "Constructors" . subDlist
+subConstructors = divSubDecls "constructors" "Constructors" . subTable
subFields :: [(Html, Maybe (Doc DocName), [Html])] -> Html
-subFields = divSubDecls "fields" "Fields" . subDlist
+subFields = divSubDecls "fields" "Fields" . subTable
-- a box for displaying code