-- | Provides xhtml constructors for 'Text.XML.Light'.
module Text.HTML.Light ( module Text.HTML.Light
                       , module Text.HTML.Light.Attribute
                       , module Text.HTML.Light.Constant
                       , module Text.HTML.Light.Element ) where

import Text.XML.Light
import Text.HTML.Light.Attribute
import Text.HTML.Light.Constant
import Text.HTML.Light.Element

-- | Ordinary character data, subject to escaping.
cdata :: String -> Content
cdata s = Text (CData CDataText s Nothing)

-- | Raw character data, not subject to escaping.
cdata_raw :: String -> Content
cdata_raw s = Text (CData CDataRaw s Nothing)

-- | Render an xhtml element with the given document type.
renderXHTML :: DocType -> Element -> String
renderXHTML t e = concat [ xml_1_0
                         , t
                         , showElement e ]