1 {-# LANGUAGE OverloadedLists #-}
2 {-# LANGUAGE OverloadedStrings #-}
3 module Text.Blaze.DTC where
6 import Data.Text (Text)
8 import Text.Blaze.Internal
10 import Text.Blaze.Utils
11 import Text.Blaze.XML (XML)
16 xmlModel :: Text -> DTC
18 Leaf "xml-model" "<?xml-model" "?>\n" ()
19 ! attribute "type" " type=\"" "application/relax-ng-compact-syntax"
20 ! attribute "href" " href=\"" (attrValue rnc)
22 xmlStylesheet :: Text -> DTC
24 Leaf "xml-stylesheet" "<?xml-stylesheet" "?>\n" ()
25 ! attribute "type" " type=\"" "text/xsl"
26 ! attribute "href" " href=\"" (attrValue xsl)
28 html5Stylesheet :: Text -> DTC
30 Leaf "html5-stylesheet" "<?html5-stylesheet" "?>\n" ()
31 ! attribute "type" " type=\"" "text/xsl"
32 ! attribute "href" " href=\"" (attrValue xsl)
34 atomStylesheet :: Text -> DTC
36 Leaf "atom-stylesheet" "<?atom-stylesheet" "?>\n" ()
37 ! attribute "type" " type=\"" "text/xsl"
38 ! attribute "href" " href=\"" (attrValue xsl)
41 about = Parent "about" "<about" "</about>"
43 alias = Leaf "alias" "<alias" "/>" ()
45 address = Leaf "address" "<address" "/>" ()
47 artwork = Parent "artwork" "<artwork" "</artwork>"
49 author = Parent "author" "<author" "</author>"
51 b = Parent "b" "<b" "</b>"
53 br = Leaf "br" "<br" " />" ()
55 call = Parent "call" "<call" "</call>"
57 code = Parent "code" "<code" "</code>"
58 comment :: Text -> DTC
59 comment t = Comment (Text t) ()
61 date = Leaf "date" "<date" "/>" ()
63 define = Parent "define" "<define" "</define>"
65 del = Parent "del" "<del" "</del>"
66 document :: DTC -> DTC
67 document = Parent "document" "<document" "</document>"
69 editor = Parent "editor" "<editor" "</editor>"
71 email = Parent "email" "<email" "</email>"
73 eref (Empty a) = Leaf "eref" "<eref" "/>" a
74 eref x = Parent "eref" "<eref" "</eref>" x
76 figure = Parent "figure" "<figure" "</figure>"
78 i = Parent "i" "<i" "</i>"
79 include :: Bool -> DTC
81 Leaf "include" "<include" "/>" ()
82 !? (not inc, attribute "include" " include=\"" "no")
84 index = Parent "index" "<index" "</index>"
86 iref (Empty a) = Leaf "iref" "<iref" "/>" a
87 iref x = Parent "iref" "<iref" "</iref>" x
89 keyword = Parent "keyword" "<keyword" "</keyword>"
91 li = Parent "li" "<li" "</li>"
93 link = Parent "link" "<link" "</link>"
95 macro = Parent "macro" "<macro" "</macro>"
97 note = Parent "note" "<note" "</note>"
99 ol = Parent "ol" "<ol" "</ol>"
100 organization :: DTC -> DTC
101 organization = Parent "organization" "<organization" "</organization>"
103 para = Parent "para" "<para" "</para>"
105 q = Parent "q" "<q" "</q>"
107 quote = Parent "quote" "<quote" "</quote>"
109 ref (Empty a) = Leaf "ref" "<ref" "/>" a
110 ref x = Parent "ref" "<ref" "</ref>" x
111 reference :: DTC -> DTC
112 reference = Parent "reference" "<reference" "</reference>"
114 rl = Parent "rl" "<rl" "</rl>"
116 rref (Empty a) = Leaf "rref" "<rref" "/>" a
117 rref x = Parent "rref" "<rref" "</rref>" x
119 sc = Parent "sc" "<sc" "</sc>"
120 section :: DTC -> DTC
121 section = Parent "section" "<section" "</section>"
123 sub = Parent "sub" "<sub" "</sub>"
125 sup = Parent "sup" "<sup" "</sup>"
127 title = Parent "title" "<title" "</title>"
129 toc = Leaf "toc" "<toc" "/>" ()
131 tof = Leaf "tof" "<tof" "/>" ()
133 u = Parent "u" "<u" "</u>"
135 ul = Parent "ul" "<ul" "</ul>"
136 version :: DTC -> DTC
137 version = Parent "version" "<version" "</version>"
139 indentTag :: Text -> IndentTag
142 "about" -> IndentTagChildren
143 "address" -> IndentTagChildren
144 "author" -> IndentTagChildren
145 "document" -> IndentTagChildren
146 "editor" -> IndentTagChildren
147 "figure" -> IndentTagChildren
148 "ol" -> IndentTagChildren
149 "postal" -> IndentTagChildren
150 "reference" -> IndentTagChildren
151 "rl" -> IndentTagChildren
152 "section" -> IndentTagChildren
153 "ul" -> IndentTagChildren
157 "li" -> IndentTagText
158 "para" -> IndentTagText
160 "quote" -> IndentTagText
161 "note" -> IndentTagText
162 _ -> IndentTagPreserve