module Blaze.Html5
(module Text.Blaze
,module Text.Blaze.Html5
,Attributable
,(!.)
,(!#)
,linesToHtml)
where
import Data.Monoid
import Text.Blaze
import Text.Blaze.Html5 hiding (map)
import qualified Text.Blaze.Html5.Attributes as A
import Text.Blaze.Internal (Attributable)
(!.) :: (Attributable h) => h -> AttributeValue -> h
elem !. className = elem ! A.class_ className
(!#) :: (Attributable h) => h -> AttributeValue -> h
elem !# idName = elem ! A.id idName
linesToHtml :: [Html] -> Html
linesToHtml = htmlIntercalate br
htmlIntercalate :: Html -> [Html] -> Html
htmlIntercalate _ [x] = x
htmlIntercalate sep (x:xs) = do x; sep; htmlIntercalate sep xs
htmlIntercalate _ [] = mempty
htmlCommasAnd :: [Html] -> Html
htmlCommasAnd [x] = x
htmlCommasAnd [x,y] = do x; " and "; y
htmlCommasAnd (x:xs) = do x; ", "; htmlCommasAnd xs
htmlCommasAnd [] = mempty
htmlCommas :: [Html] -> Html
htmlCommas = htmlIntercalate ", "