From 17970e6b6aa22962c498ce02ead8dbadad31a733 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 8 Mar 2014 09:42:00 +0100 Subject: 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. --- src/Haddock/Backends/Xhtml/Utils.hs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/Haddock/Backends/Xhtml/Utils.hs') 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 -- cgit v1.2.3