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
12 import Text.Blaze.XML (XML)
17 xmlModel :: Text -> DTC
19 Leaf "xml-model" "<?xml-model" "?>\n" ()
20 ! attribute "type" " type=\"" "application/relax-ng-compact-syntax"
21 ! attribute "href" " href=\"" (attrValue rnc)
23 xmlStylesheet :: Text -> DTC
25 Leaf "xml-stylesheet" "<?xml-stylesheet" "?>\n" ()
26 ! attribute "type" " type=\"" "text/xsl"
27 ! attribute "href" " href=\"" (attrValue xsl)
29 html5Stylesheet :: Text -> DTC
31 Leaf "html5-stylesheet" "<?html5-stylesheet" "?>\n" ()
32 ! attribute "type" " type=\"" "text/xsl"
33 ! attribute "href" " href=\"" (attrValue xsl)
35 atomStylesheet :: Text -> DTC
37 Leaf "atom-stylesheet" "<?atom-stylesheet" "?>\n" ()
38 ! attribute "type" " type=\"" "text/xsl"
39 ! attribute "href" " href=\"" (attrValue xsl)
42 about = Parent "about" "<about" "</about>"
44 alias = Leaf "alias" "<alias" "/>" ()
46 address = Leaf "address" "<address" "/>" ()
48 artwork = Parent "artwork" "<artwork" "</artwork>"
50 author = Parent "author" "<author" "</author>"
52 b = Parent "b" "<b" "</b>"
54 br = Leaf "br" "<br" " />" ()
56 call = Parent "call" "<call" "</call>"
58 code = Parent "code" "<code" "</code>"
59 comment :: Text -> DTC
60 comment t = Comment (Text t) ()
62 date = Leaf "date" "<date" "/>" ()
64 define = Parent "define" "<define" "</define>"
66 del = Parent "del" "<del" "</del>"
67 document :: DTC -> DTC
68 document = Parent "document" "<document" "</document>"
70 editor = Parent "editor" "<editor" "</editor>"
72 email = Parent "email" "<email" "</email>"
74 eref (Empty a) = Leaf "eref" "<eref" "/>" a
75 eref x = Parent "eref" "<eref" "</eref>" x
77 figure = Parent "figure" "<figure" "</figure>"
79 i = Parent "i" "<i" "</i>"
80 include :: Bool -> DTC
82 Leaf "include" "<include" "/>" ()
83 !? (not inc, attribute "include" " include=\"" "no")
85 index = Parent "index" "<index" "</index>"
87 iref (Empty a) = Leaf "iref" "<iref" "/>" a
88 iref x = Parent "iref" "<iref" "</iref>" x
90 keyword = Parent "keyword" "<keyword" "</keyword>"
92 li = Parent "li" "<li" "</li>"
94 link = Parent "link" "<link" "</link>"
96 macro = Parent "macro" "<macro" "</macro>"
98 note = Parent "note" "<note" "</note>"
100 ol = Parent "ol" "<ol" "</ol>"
101 organization :: DTC -> DTC
102 organization = Parent "organization" "<organization" "</organization>"
104 para = Parent "para" "<para" "</para>"
106 q = Parent "q" "<q" "</q>"
108 quote = Parent "quote" "<quote" "</quote>"
110 ref (Empty a) = Leaf "ref" "<ref" "/>" a
111 ref x = Parent "ref" "<ref" "</ref>" x
112 reference :: DTC -> DTC
113 reference = Parent "reference" "<reference" "</reference>"
115 rl = Parent "rl" "<rl" "</rl>"
117 rref (Empty a) = Leaf "rref" "<rref" "/>" a
118 rref x = Parent "rref" "<rref" "</rref>" x
120 sc = Parent "sc" "<sc" "</sc>"
121 section :: DTC -> DTC
122 section = Parent "section" "<section" "</section>"
124 sub = Parent "sub" "<sub" "</sub>"
126 sup = Parent "sup" "<sup" "</sup>"
128 title = Parent "title" "<title" "</title>"
130 toc = Leaf "toc" "<toc" "/>" ()
132 tof = Leaf "tof" "<tof" "/>" ()
134 u = Parent "u" "<u" "</u>"
136 ul = Parent "ul" "<ul" "</ul>"
137 version :: DTC -> DTC
138 version = Parent "version" "<version" "</version>"
140 indentTag :: Text -> IndentTag
143 "about" -> IndentTagChildren
144 "address" -> IndentTagChildren
145 "author" -> IndentTagChildren
146 "document" -> IndentTagChildren
147 "editor" -> IndentTagChildren
148 "figure" -> IndentTagChildren
149 "ol" -> IndentTagChildren
150 "postal" -> IndentTagChildren
151 "reference" -> IndentTagChildren
152 "rl" -> IndentTagChildren
153 "section" -> IndentTagChildren
154 "ul" -> IndentTagChildren
158 "li" -> IndentTagText
159 "para" -> IndentTagText
161 "quote" -> IndentTagText
162 "note" -> IndentTagText
163 _ -> IndentTagPreserve