-- | xhtml related constants.
module Text.HTML.Light.Constant where

import Text.XML.Light

-- * Named non-ascii characters

-- | The copyright character.
copy :: Content
copy = Text (CData CDataRaw "©" Nothing)

-- | The left arrow character.
larr :: Content
larr = Text (CData CDataRaw "←" Nothing)

-- | The non-breaking space character.
nbsp :: Content
nbsp = Text (CData CDataRaw " " Nothing)

-- | The right arrow character.
rarr :: Content
rarr = Text (CData CDataRaw "→" Nothing)

-- * Version and document type strings

-- | The xml version 1.0 string with UTF-8 encoding set.
xml_1_0 :: String
xml_1_0 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"

-- | A type synonym for document type strings.
type DocType = String

-- | The xhtml 1.0 strict document type string.
xhtml_1_0_strict :: DocType
xhtml_1_0_strict = 
    let dtd = "PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
        url = "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\""
    in concat ["<!DOCTYPE html ", dtd, " ", url, ">"]

-- | The xhtml 1.0 transitional document type string.
xhtml_1_0_transitional :: DocType
xhtml_1_0_transitional =
    let dtd = "PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""
        url = "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\""
    in concat ["<!DOCTYPE html ", dtd, " ", url, ">"]