{-# LANGUAGE OverloadedLists #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} module Text.Blaze.DTC where import Data.Bool import Data.Text (Text) import Text.Blaze import Text.Blaze.Internal import Text.Blaze.Utils import Text.Blaze.XML (XML) -- * Type 'DTC' type DTC = XML xmlModel :: Text -> DTC xmlModel rnc = Leaf "xml-model" "\n" () ! attribute "type" " type=\"" "application/relax-ng-compact-syntax" ! attribute "href" " href=\"" (attrValue rnc) xmlStylesheet :: Text -> DTC xmlStylesheet xsl = Leaf "xml-stylesheet" "\n" () ! attribute "type" " type=\"" "text/xsl" ! attribute "href" " href=\"" (attrValue xsl) html5Stylesheet :: Text -> DTC html5Stylesheet xsl = Leaf "html5-stylesheet" "\n" () ! attribute "type" " type=\"" "text/xsl" ! attribute "href" " href=\"" (attrValue xsl) atomStylesheet :: Text -> DTC atomStylesheet xsl = Leaf "atom-stylesheet" "\n" () ! attribute "type" " type=\"" "text/xsl" ! attribute "href" " href=\"" (attrValue xsl) about :: DTC -> DTC about = Parent "about" "" alias :: DTC alias = Leaf "alias" "" () address :: DTC address = Leaf "address" "" () artwork :: DTC -> DTC artwork = Parent "artwork" "" author :: DTC -> DTC author = Parent "author" "" b :: DTC -> DTC b = Parent "b" "" br :: DTC br = Leaf "br" "" () call :: DTC -> DTC call = Parent "call" "" code :: DTC -> DTC code = Parent "code" "" comment :: Text -> DTC comment t = Comment (Text t) () date :: DTC date = Leaf "date" "" () define :: DTC -> DTC define = Parent "define" "" del :: DTC -> DTC del = Parent "del" "" document :: DTC -> DTC document = Parent "document" "" editor :: DTC -> DTC editor = Parent "editor" "" email :: DTC -> DTC email = Parent "email" "" eref :: DTC -> DTC eref (Empty a) = Leaf "eref" "" a eref x = Parent "eref" "" x figure :: DTC -> DTC figure = Parent "figure" "" i :: DTC -> DTC i = Parent "i" "" include :: Bool -> DTC include inc = Leaf "include" "" () !? (not inc, attribute "include" " include=\"" "no") index :: DTC -> DTC index = Parent "index" "" iref :: DTC -> DTC iref (Empty a) = Leaf "iref" "" a iref x = Parent "iref" "" x keyword :: DTC -> DTC keyword = Parent "keyword" "" li :: DTC -> DTC li = Parent "li" "" link :: DTC -> DTC link = Parent "link" "" macro :: DTC -> DTC macro = Parent "macro" "" note :: DTC -> DTC note = Parent "note" "" ol :: DTC -> DTC ol = Parent "ol" "" organization :: DTC -> DTC organization = Parent "organization" "" para :: DTC -> DTC para = Parent "para" "" q :: DTC -> DTC q = Parent "q" "" quote :: DTC -> DTC quote = Parent "quote" "" ref :: DTC -> DTC ref (Empty a) = Leaf "ref" "" a ref x = Parent "ref" "" x reference :: DTC -> DTC reference = Parent "reference" "" rl :: DTC -> DTC rl = Parent "rl" "" rref :: DTC -> DTC rref (Empty a) = Leaf "rref" "" a rref x = Parent "rref" "" x sc :: DTC -> DTC sc = Parent "sc" "" section :: DTC -> DTC section = Parent "section" "" sub :: DTC -> DTC sub = Parent "sub" "" sup :: DTC -> DTC sup = Parent "sup" "" title :: DTC -> DTC title = Parent "title" "" toc :: DTC toc = Leaf "toc" "" () tof :: DTC tof = Leaf "tof" "" () u :: DTC -> DTC u = Parent "u" "" ul :: DTC -> DTC ul = Parent "ul" "" version :: DTC -> DTC version = Parent "version" "" indentTag :: Text -> IndentTag indentTag t = case t of "about" -> IndentTagChildren "address" -> IndentTagChildren "author" -> IndentTagChildren "document" -> IndentTagChildren "editor" -> IndentTagChildren "figure" -> IndentTagChildren "ol" -> IndentTagChildren "postal" -> IndentTagChildren "reference" -> IndentTagChildren "rl" -> IndentTagChildren "section" -> IndentTagChildren "ul" -> IndentTagChildren "a" -> IndentTagText "b" -> IndentTagText "i" -> IndentTagText "li" -> IndentTagText "para" -> IndentTagText "q" -> IndentTagText "quote" -> IndentTagText "note" -> IndentTagText _ -> IndentTagPreserve