Skip to content
Snippets Groups Projects
Commit b99698a2 authored by Mark Lentczner's avatar Mark Lentczner
Browse files

give a class to empty dd elements so they can be hidden

parent ccb3be7d
No related branches found
No related tags found
No related merge requests found
......@@ -354,6 +354,10 @@ div#style-menu-holder {
margin-bottom: 0.5em;
}
#interface dd.empty {
display: none;
}
#interface dd p {
margin: 0;
}
......
......@@ -186,7 +186,7 @@ bodyHtml doctitle iface themes
pageContent =
body << [
divPackageHeader << [
sectionName << nonEmpty doctitle,
nonEmpty sectionName << doctitle,
unordList (catMaybes [
srcButton maybe_source_url iface,
wikiButton maybe_wiki_url (ifaceMod `fmap` iface),
......
......@@ -90,8 +90,11 @@ rdrDocToHtml = markup fmt . cleanup
where fmt = parHtmlMarkup ppRdrName isRdrTc
docElement :: (ADDATTRS a) => a -> a
docElement = (! [theclass "doc"])
docElement :: (Html -> Html) -> Html -> Html
docElement el content_ =
if isNoHtml content_
then el ! [theclass "doc empty"] << spaceHtml
else el ! [theclass "doc"] << content_
docSection :: Doc DocName -> Html
......
......@@ -117,11 +117,7 @@ subDlist decls = Just $ dlist << map subEntry decls +++ clearDiv
subEntry (decl, mdoc, subs) =
dterm ! [theclass "src"] << decl
+++
docElement ddef << (fmap docToHtml mdoc `with` subs)
Nothing `with` [] = spaceHtml
ma `with` bs = ma +++ bs
docElement ddef << (fmap docToHtml mdoc +++ subs)
clearDiv = thediv ! [ theclass "clear" ] << noHtml
......@@ -132,7 +128,7 @@ subTable decls = Just $ table << aboves (concatMap subRow decls)
subRow (decl, mdoc, subs) =
(td ! [theclass "src"] << decl
<->
docElement td << nonEmpty (fmap docToHtml mdoc))
docElement td << fmap docToHtml mdoc)
: map (cell . (td <<)) subs
......
......@@ -113,10 +113,13 @@ char :: Char -> Html
char c = toHtml [c]
-- | Ensure content contains at least something (a non-breaking space)
nonEmpty :: (HTML a) => a -> Html
nonEmpty a = if isNoHtml h then spaceHtml else h
where h = toHtml a
-- | Make an element that always has at least something (a non-breaking space)
-- If it would have otherwise been empty, then give it the class ".empty"
nonEmpty :: (Html -> Html) -> Html -> Html
nonEmpty el content_ =
if isNoHtml content_
then el ! [theclass "empty"] << spaceHtml
else el << content_
quote :: Html -> Html
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment