1 {-# LANGUAGE DisambiguateRecordFields #-}
2 {-# LANGUAGE DuplicateRecordFields #-}
3 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
4 module Language.DTC.Document
5 ( module Language.DTC.Document
9 import Data.Default.Class (Default(..))
12 import Data.Maybe (Maybe(..))
13 import Data.Monoid (Monoid(..))
14 import Data.Semigroup (Semigroup(..))
15 import Data.Text (Text)
16 import Data.TreeSeq.Strict (Trees)
17 import Text.Show (Show)
27 instance Default Document where
38 instance Default Head where
48 , editor :: Maybe Entity
54 , includes :: [Include]
56 instance Default About where
68 instance Semigroup About where
70 { titles = titles x <> titles y
71 , authors = authors x <> authors y
72 , editor = editor x <> editor y
73 , date = date x <> date y
74 , version = version x <> version y
75 , keywords = keywords x <> keywords y
76 , links = links x <> links y
77 , series = series x <> series y
78 , includes = includes x <> includes y
82 type Body = Trees BodyKey BodyValue
86 = Section { pos :: XmlPos
87 , attrs :: CommonAttrs
93 -- ** Type 'BodyValue'
96 , attrs :: CommonAttrs
100 , attrs :: CommonAttrs
103 | Figure { pos :: XmlPos
104 , attrs :: CommonAttrs
109 | Index { pos :: XmlPos
110 , attrs :: CommonAttrs
118 = Para { pos :: XmlPos
119 , attrs :: CommonAttrs
120 , horis :: Horizontals
123 , attrs :: CommonAttrs
124 , items :: [Verticals]
127 , attrs :: CommonAttrs
128 , items :: [Verticals]
131 , attrs :: CommonAttrs
132 , refs :: [Reference]
134 | Artwork { pos :: XmlPos
135 , attrs :: CommonAttrs
141 -- * Type 'CommonAttrs'
154 -- * Type 'Verticals'
155 type Verticals = [Vertical]
162 -- * Type 'Horizontal'
175 | Eref {href :: URL, text :: Horizontals}
176 | Iref {count :: Int, term :: Text, text :: Horizontals}
177 | Ref {to :: Ident, text :: Horizontals}
178 | Rref {to :: Ident, text :: Horizontals}
182 -- * Type 'Horizontals'
183 type Horizontals = [Horizontal]
186 newtype Title = Title { unTitle :: Horizontals }
187 deriving (Eq,Show,Default)
201 instance Default Address where
218 instance Default Include where
223 -- * Type 'Reference'
230 reference :: Ident -> Reference
237 instance Default Reference where
246 instance Default Entity where
251 instance Semigroup Entity where
258 , month :: Maybe Nat1
261 instance Default Date where
264 , month = Just (Nat1 01)
265 , day = Just (Nat1 01)
267 instance Semigroup Date where
276 , body :: Horizontals
278 instance Default Link where
291 instance Default Alias where
302 instance Default Serie where