aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Backends/Xhtml/Utils.hs
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2014-03-08 09:42:00 +0100
committerNiklas Haas <git@nand.wakku.to>2014-03-08 09:43:26 +0100
commit17970e6b6aa22962c498ce02ead8dbadad31a733 (patch)
tree0c9232390bce92d8b393214a2d2131a17bc3f07e /src/Haddock/Backends/Xhtml/Utils.hs
parente5bd27b5edf533054513871dc475a54a8b1bee23 (diff)
Render fixity information
Affects functions, type synonyms, type families, class names, data type names, constructors, data families, associated TFs/DFs, type synonyms, pattern synonyms and everything else I could think of.
Diffstat (limited to 'src/Haddock/Backends/Xhtml/Utils.hs')
-rw-r--r--src/Haddock/Backends/Xhtml/Utils.hs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/Haddock/Backends/Xhtml/Utils.hs b/src/Haddock/Backends/Xhtml/Utils.hs
index 232e18cc..cbcbbd6d 100644
--- a/src/Haddock/Backends/Xhtml/Utils.hs
+++ b/src/Haddock/Backends/Xhtml/Utils.hs
@@ -17,13 +17,13 @@ module Haddock.Backends.Xhtml.Utils (
spliceURL,
groupId,
- (<+>), char,
+ (<+>), (<=>), char,
keyword, punctuate,
braces, brackets, pabrackets, parens, parenList, ubxParenList,
arrow, comma, dcolon, dot, darrow, equals, forallSymbol, quote,
- hsep,
+ hsep, vcat,
collapseSection, collapseToggle, collapseControl,
) where
@@ -100,6 +100,11 @@ hsep :: [Html] -> Html
hsep [] = noHtml
hsep htmls = foldr1 (\a b -> a+++" "+++b) htmls
+-- | Concatenate a series of 'Html' values vertically, with linebreaks in between.
+vcat :: [Html] -> Html
+vcat [] = noHtml
+vcat htmls = foldr1 (\a b -> a+++br+++b) htmls
+
infixr 8 <+>
(<+>) :: Html -> Html -> Html
@@ -107,6 +112,14 @@ a <+> b = a +++ sep +++ b
where
sep = if isNoHtml a || isNoHtml b then noHtml else toHtml " "
+-- | Join two 'Html' values together with a linebreak in between.
+-- Has 'noHtml' as left identity.
+infixr 8 <=>
+(<=>) :: Html -> Html -> Html
+a <=> b = a +++ sep +++ b
+ where
+ sep = if isNoHtml a then noHtml else br
+
keyword :: String -> Html
keyword s = thespan ! [theclass "keyword"] << toHtml s