diff options
author | Phil Ruffwind <rf@rufflewind.com> | 2015-07-27 05:58:58 -0400 |
---|---|---|
committer | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2015-08-02 23:30:07 +0100 |
commit | c274363d5d868c838c382a52428c667090514f86 (patch) | |
tree | 29bd0b47564a8812306606d190d1fe6513fc4579 /haddock-api | |
parent | e190efe089a0bd038c7de41c1c52ef580e52712c (diff) |
Fix record field alignment when name is too long
Change <dl> to <ul> and use display:table rather than floats to layout
the record fields. This avoids bug #301 that occurs whenever the field
name gets too long.
Slight aesthetic change: the entire cell of the field's source code is
now shaded gray rather than just the area where text exists.
Fixes #301. Closes #421
Diffstat (limited to 'haddock-api')
-rw-r--r-- | haddock-api/resources/html/Ocean.std-theme/ocean.css | 29 | ||||
-rw-r--r-- | haddock-api/src/Haddock/Backends/Xhtml/Layout.hs | 10 |
2 files changed, 19 insertions, 20 deletions
diff --git a/haddock-api/resources/html/Ocean.std-theme/ocean.css b/haddock-api/resources/html/Ocean.std-theme/ocean.css index 1cc55cb6..9ad9f9d2 100644 --- a/haddock-api/resources/html/Ocean.std-theme/ocean.css +++ b/haddock-api/resources/html/Ocean.std-theme/ocean.css @@ -427,30 +427,31 @@ div#style-menu-holder { visibility: hidden; } -.subs dl { +.subs ul { + list-style: none; + display: table; margin: 0; } -.subs dt { - float: left; - clear: left; - display: block; +.subs ul li { + display: table-row; +} + +.subs ul li dfn { + display: table-cell; + font-style: normal; + font-weight: bold; margin: 1px 0; + white-space: nowrap; } -.subs dd { - float: right; - width: 90%; - display: block; +.subs ul li > .doc { + display: table-cell; padding-left: 0.5em; margin-bottom: 0.5em; } -.subs dd.empty { - display: none; -} - -.subs dd p { +.subs ul li > .doc p { margin: 0; } diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs index e79c2c3d..4714c1b6 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs @@ -127,14 +127,12 @@ divSubDecls cssClass captionName = maybe noHtml wrap subDlist :: Qualification -> [SubDecl] -> Maybe Html subDlist _ [] = Nothing -subDlist qual decls = Just $ dlist << map subEntry decls +++ clearDiv +subDlist qual decls = Just $ ulist << map subEntry decls where subEntry (decl, mdoc, subs) = - dterm ! [theclass "src"] << decl - +++ - docElement ddef << (fmap (docToHtml Nothing qual) mdoc +++ subs) - - clearDiv = thediv ! [ theclass "clear" ] << noHtml + li << + (define ! [theclass "src"] << decl +++ + docElement thediv << (fmap (docToHtml Nothing qual) mdoc +++ subs)) subTable :: Qualification -> [SubDecl] -> Maybe Html |