aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Backends/Xhtml/Utils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Haddock/Backends/Xhtml/Utils.hs')
-rw-r--r--src/Haddock/Backends/Xhtml/Utils.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Haddock/Backends/Xhtml/Utils.hs b/src/Haddock/Backends/Xhtml/Utils.hs
index 30abfdcd..edb5e659 100644
--- a/src/Haddock/Backends/Xhtml/Utils.hs
+++ b/src/Haddock/Backends/Xhtml/Utils.hs
@@ -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