1 {-# LANGUAGE OverloadedLists #-}
2 {-# LANGUAGE OverloadedStrings #-}
3 {-# LANGUAGE RecordWildCards #-}
4 module Text.Blaze.DTC where
7 import Data.Text (Text)
9 import Text.Blaze.Internal
11 import Text.Blaze.Utils
19 xmlModel :: Text -> DTC
21 Leaf "xml-model" "<?xml-model" "?>\n" ()
22 ! attribute "type" " type=\"" "application/relax-ng-compact-syntax"
23 ! attribute "href" " href=\"" (attrValue rnc)
25 xmlStylesheet :: Text -> DTC
27 Leaf "xml-stylesheet" "<?xml-stylesheet" "?>\n" ()
28 ! attribute "type" " type=\"" "text/xsl"
29 ! attribute "href" " href=\"" (attrValue xsl)
31 html5Stylesheet :: Text -> DTC
33 Leaf "html5-stylesheet" "<?html5-stylesheet" "?>\n" ()
34 ! attribute "type" " type=\"" "text/xsl"
35 ! attribute "href" " href=\"" (attrValue xsl)
37 atomStylesheet :: Text -> DTC
39 Leaf "atom-stylesheet" "<?atom-stylesheet" "?>\n" ()
40 ! attribute "type" " type=\"" "text/xsl"
41 ! attribute "href" " href=\"" (attrValue xsl)
44 about = Parent "about" "<about" "</about>"
46 alias = Leaf "alias" "<alias" "/>" ()
48 address = Leaf "address" "<address" "/>" ()
50 artwork = Parent "artwork" "<artwork" "</artwork>"
52 author = Parent "author" "<author" "</author>"
54 b = Parent "b" "<b" "</b>"
56 br = Leaf "br" "<br" " />" ()
58 call = Parent "call" "<call" "</call>"
60 code = Parent "code" "<code" "</code>"
61 comment :: Text -> DTC
62 comment t = Comment (Text t) ()
64 date = Leaf "date" "<date" "/>" ()
66 define = Parent "define" "<define" "</define>"
68 del = Parent "del" "<del" "</del>"
69 document :: DTC -> DTC
70 document = Parent "document" "<document" "</document>"
72 editor = Parent "editor" "<editor" "</editor>"
74 email = Parent "email" "<email" "</email>"
76 eref (Empty a) = Leaf "eref" "<eref" "/>" a
77 eref x = Parent "eref" "<eref" "</eref>" x
79 figure = Parent "figure" "<figure" "</figure>"
81 i = Parent "i" "<i" "</i>"
82 include :: Bool -> DTC
84 Leaf "include" "<include" "/>" ()
85 !? (not inc, attribute "include" " include=\"" "no")
87 index = Parent "index" "<index" "</index>"
89 iref (Empty a) = Leaf "iref" "<iref" "/>" a
90 iref x = Parent "iref" "<iref" "</iref>" x
92 keyword = Parent "keyword" "<keyword" "</keyword>"
94 li = Parent "li" "<li" "</li>"
96 link = Parent "link" "<link" "</link>"
98 macro = Parent "macro" "<macro" "</macro>"
100 note = Parent "note" "<note" "</note>"
102 ol = Parent "ol" "<ol" "</ol>"
103 organization :: DTC -> DTC
104 organization = Parent "organization" "<organization" "</organization>"
106 para = Parent "para" "<para" "</para>"
108 q = Parent "q" "<q" "</q>"
110 quote = Parent "quote" "<quote" "</quote>"
112 ref (Empty a) = Leaf "ref" "<ref" "/>" a
113 ref x = Parent "ref" "<ref" "</ref>" x
114 reference :: DTC -> DTC
115 reference = Parent "reference" "<reference" "</reference>"
117 rl = Parent "rl" "<rl" "</rl>"
119 rref (Empty a) = Leaf "rref" "<rref" "/>" a
120 rref x = Parent "rref" "<rref" "</rref>" x
122 sc = Parent "sc" "<sc" "</sc>"
123 section :: DTC -> DTC
124 section = Parent "section" "<section" "</section>"
126 sub = Parent "sub" "<sub" "</sub>"
128 sup = Parent "sup" "<sup" "</sup>"
130 title = Parent "title" "<title" "</title>"
132 toc = Leaf "toc" "<toc" "/>" ()
134 tof = Leaf "tof" "<tof" "/>" ()
136 u = Parent "u" "<u" "</u>"
138 ul = Parent "ul" "<ul" "</ul>"
139 version :: DTC -> DTC
140 version = Parent "version" "<version" "</version>"
142 indentTag :: Text -> IndentTag
145 "about" -> IndentTagChildren
146 "address" -> IndentTagChildren
147 "author" -> IndentTagChildren
148 "document" -> IndentTagChildren
149 "editor" -> IndentTagChildren
150 "figure" -> IndentTagChildren
151 "ol" -> IndentTagChildren
152 "postal" -> IndentTagChildren
153 "reference" -> IndentTagChildren
154 "rl" -> IndentTagChildren
155 "section" -> IndentTagChildren
156 "ul" -> IndentTagChildren
160 "li" -> IndentTagText
161 "para" -> IndentTagText
163 "quote" -> IndentTagText
164 "note" -> IndentTagText
165 _ -> IndentTagPreserve