1 {-# LANGUAGE DisambiguateRecordFields #-}
2 {-# LANGUAGE DuplicateRecordFields #-}
3 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
4 {-# LANGUAGE NamedFieldPuns #-}
5 module Language.DTC.Document
6 ( module Language.DTC.Document
10 import Data.Default.Class (Default(..))
13 import Data.Maybe (Maybe(..))
14 import Data.Monoid (Monoid(..))
15 import Data.Semigroup (Semigroup(..))
16 import Data.Sequence (Seq)
17 import Data.Text (Text)
18 import Data.TreeSeq.Strict (Trees)
19 import Text.Show (Show)
29 instance Default Document where
40 instance Default Head where
50 , editor :: Maybe Entity
56 , includes :: [Include]
58 instance Default About where
70 instance Semigroup About where
72 { titles = titles x <> titles y
73 , authors = authors x <> authors y
74 , editor = editor x <> editor y
75 , date = date x <> date y
76 , version = version x <> version y
77 , keywords = keywords x <> keywords y
78 , links = links x <> links y
79 , series = series x <> series y
80 , includes = includes x <> includes y
84 type Body = Trees BodyKey (Seq BodyValue)
88 = Section { attrs :: CommonAttrs
95 -- ** Type 'BodyValue'
97 = ToC { attrs :: CommonAttrs
101 | ToF { attrs :: CommonAttrs
105 | Figure { type_ :: Text
106 , attrs :: CommonAttrs
111 | Index { attrs :: CommonAttrs
119 = Para { attrs :: CommonAttrs
120 , horis :: Horizontals
123 | OL { attrs :: CommonAttrs
124 , items :: [Verticals]
127 | UL { attrs :: CommonAttrs
128 , items :: [Verticals]
131 | RL { attrs :: CommonAttrs
132 , refs :: [Reference]
135 | Artwork { attrs :: CommonAttrs
142 -- * Type 'CommonAttrs'
155 -- * Type 'Verticals'
156 type Verticals = [Vertical]
163 -- * Type 'Horizontal'
176 | Eref {href :: URL , text :: Horizontals}
177 | Iref {to :: Ident, text :: Horizontals}
178 | Ref {to :: Ident, text :: Horizontals}
179 | Rref {to :: Ident, text :: Horizontals}
183 -- * Type 'Horizontals'
184 type Horizontals = [Horizontal]
187 newtype Title = Title { unTitle :: Horizontals }
188 deriving (Eq,Show,Default)
202 instance Default Address where
219 instance Default Include where
224 -- * Type 'Reference'
231 reference :: Ident -> Reference
238 instance Default Reference where
247 instance Default Entity where
252 instance Semigroup Entity where
259 , month :: Maybe Nat1
262 instance Default Date where
265 , month = Just (Nat1 01)
266 , day = Just (Nat1 01)
268 instance Semigroup Date where
277 , body :: Horizontals
279 instance Default Link where
292 instance Default Alias where
303 instance Default Serie where