aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Backends/Xhtml/Util.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Haddock/Backends/Xhtml/Util.hs')
-rw-r--r--src/Haddock/Backends/Xhtml/Util.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Haddock/Backends/Xhtml/Util.hs b/src/Haddock/Backends/Xhtml/Util.hs
index 9e13acd6..826b69f1 100644
--- a/src/Haddock/Backends/Xhtml/Util.hs
+++ b/src/Haddock/Backends/Xhtml/Util.hs
@@ -16,7 +16,7 @@ module Haddock.Backends.Xhtml.Util (
namedAnchor, linkedAnchor,
spliceURL,
- (<+>), char, empty,
+ (<+>), char, empty, nonEmpty,
keyword, punctuate,
braces, brackets, pabrackets, parens, parenList, ubxParenList,
@@ -110,6 +110,11 @@ char c = toHtml [c]
empty :: Html
empty = noHtml
+-- | 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
+
quote :: Html -> Html
quote h = char '`' +++ h +++ '`'