1 {-# LANGUAGE DisambiguateRecordFields #-}
2 {-# LANGUAGE DuplicateRecordFields #-}
3 {-# LANGUAGE FlexibleInstances #-}
4 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
5 module Language.DTC.Document
6 ( module Language.DTC.Document
10 import Data.Default.Class (Default(..))
11 import Data.Default.Instances.Containers ()
14 import Data.Maybe (Maybe(..))
15 import Data.Monoid (Monoid(..))
17 import Data.Semigroup (Semigroup(..))
18 import Data.Text (Text)
19 import Data.TreeSeq.Strict (Trees)
20 import Text.Show (Show)
30 instance Default Document where
41 instance Default Head where
51 , editor :: Maybe Entity
57 , includes :: [Include]
59 instance Default About where
71 instance Semigroup About where
73 { titles = titles x <> titles y
74 , authors = authors x <> authors y
75 , editor = editor x <> editor y
76 , date = date x <> date y
77 , version = version x <> version y
78 , keywords = keywords x <> keywords y
79 , links = links x <> links y
80 , series = series x <> series y
81 , includes = includes x <> includes y
85 type Body = Trees BodyKey BodyValue
89 = Section { pos :: XmlPos
90 , attrs :: CommonAttrs
96 -- ** Type 'BodyValue'
99 , attrs :: CommonAttrs
102 | ToF { pos :: XmlPos
103 , attrs :: CommonAttrs
106 | Figure { pos :: XmlPos
107 , attrs :: CommonAttrs
112 | Index { pos :: XmlPos
113 , attrs :: CommonAttrs
123 type Words = [WordOrSpace]
125 -- **** Type 'WordOrSpace'
129 deriving (Eq,Ord,Show)
132 type Aliases = [Words]
135 type Terms = [Aliases]
142 = Para { pos :: XmlPos
143 , attrs :: CommonAttrs
147 , attrs :: CommonAttrs
151 , attrs :: CommonAttrs
155 , attrs :: CommonAttrs
156 , refs :: [Reference]
158 | Artwork { pos :: XmlPos
159 , attrs :: CommonAttrs
165 -- * Type 'CommonAttrs'
179 type Blocks = [Block]
187 type Lines = Trees LineKey LineValue
202 | Iref {count :: Int, term :: Words}
207 -- ** Type 'LineValue'
214 newtype Title = Title { unTitle :: Lines }
215 deriving (Eq,Show,Default)
229 instance Default Address where
246 instance Default Include where
251 -- * Type 'Reference'
258 reference :: Ident -> Reference
265 instance Default Reference where
274 instance Default Entity where
279 instance Semigroup Entity where
286 , month :: Maybe Nat1
289 instance Default Date where
292 , month = Just (Nat1 01)
293 , day = Just (Nat1 01)
295 instance Semigroup Date where
306 instance Default Link where
319 instance Default Alias where
330 instance Default Serie where