diff options
author | Neil Mitchell <unknown> | 2007-02-06 17:49:12 +0000 |
---|---|---|
committer | Neil Mitchell <unknown> | 2007-02-06 17:49:12 +0000 |
commit | 88b0377f346fa62ff05c196d4050c6990520a3cf (patch) | |
tree | 61aca07ceef4dfaa32a48e5a167ac85b59e06e35 | |
parent | d0cdb903b5f28e30bb4bdb8b47001d2e15939d41 (diff) |
Do not create empty tables for data declarations which don't have any constructors, instances or comments. Gets better HTML 4.01 compliance
-rw-r--r-- | src/Haddock/Backends/Html.hs | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/Haddock/Backends/Html.hs b/src/Haddock/Backends/Html.hs index cc7077b1..f28bc3a3 100644 --- a/src/Haddock/Backends/Html.hs +++ b/src/Haddock/Backends/Html.hs @@ -945,16 +945,30 @@ ppDataDecl summary links instances x loc mbDoc dataDecl instId = collapseId name - instancesBit - | null instances = Html.emptyTable - | otherwise - = instHdr instId </> - tda [theclass "body"] << - collapsed thediv instId ( - spacedTable1 << ( - aboves (map (declBox . ppInstHead) instances) + | otherwise + = dataheader </> + tda [theclass "body"] << vanillaTable << ( + datadoc </> + constr_bit </> + instances_bit ) - ) + where + dataheader = topDeclBox links loc nm (ppHsDataHeader False is_newty nm args) + + constr_table + | any isRecDecl cons = spacedTable5 + | otherwise = spacedTable1 + + datadoc | isJust doc = ndocBox (docToHtml (fromJust doc)) + | otherwise = Html.emptyTable + + constr_bit + | null cons = Html.emptyTable + | otherwise = + constr_hdr </> + (tda [theclass "body"] << constr_table << + aboves (map ppSideBySideConstr cons) + ) isRecCon lcon = case con_details (unLoc lcon) of RecCon _ -> True |