]> gitweb @ CieloNegro.org - Rakka.git/blob - Rakka/Wiki.hs
Implemented more features
[Rakka.git] / Rakka / Wiki.hs
1 module Rakka.Wiki
2     ( WikiPage
3     , BlockElement(..)
4     , InlineElement(..)
5
6     , ListElement(..)
7     , ListType(..)
8     , ListItem
9
10     , Definition(..)
11
12     , CommandType(..)
13     , Attribute
14     , InlineCommand(..)
15     )
16     where
17
18 import           Rakka.Page
19
20
21 type WikiPage = [BlockElement]
22
23
24 data BlockElement
25     = Heading {
26         headingLevel :: !Int
27       , headingText  :: !String
28       }
29     | HorizontalLine
30     | List !ListElement
31     | DefinitionList ![Definition]
32     | Preformatted ![InlineElement]
33     | Paragraph ![InlineElement]
34     deriving (Eq, Show)
35
36
37 data InlineElement
38     = Text !String
39     | Italic ![InlineElement]
40     | Bold ![InlineElement]
41     | PageLink {
42         linkPage     :: !(Maybe PageName)
43       , linkFragment :: !(Maybe String)
44       , linkText     :: !(Maybe String)
45       }
46     | LineBreak ![Attribute]
47     | InlineCmd !InlineCommand
48     deriving (Eq, Show)
49
50
51 data ListElement
52     = ListElement {
53         listType  :: !ListType
54       , listItems :: ![ListItem]
55       }
56     deriving (Eq, Show)
57
58
59 data ListType
60     = Bullet
61     | Numbered
62     deriving (Eq, Show)
63
64
65 type ListItem = [Either ListElement InlineElement]
66
67
68 data Definition
69     = Definition {
70         defTerm :: ![InlineElement]
71       , defDesc :: ![InlineElement]
72       }
73     deriving (Eq, Show)
74
75
76 data CommandType
77     = InlineCommandType
78     | BlockCommandType
79
80
81 type Attribute = (String, String)
82
83
84 data InlineCommand
85     = InlineCommand {
86         iCmdName       :: !String
87       , iCmdAttributes :: ![Attribute]
88       , iCmdContents   :: ![InlineElement]
89       }
90     deriving (Eq, Show)