]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Wiki.hs
The big change
[Rakka.git] / Rakka / Wiki.hs
index f8341ec8506d6069e4a152d4db50371b5bcaee1b..af50afbc7adef90939cdba3376cad8bca3de214b 100644 (file)
@@ -1,16 +1,18 @@
 module Rakka.Wiki
     ( WikiPage
+
+    , Element(..)
+    , Attribute
+
     , BlockElement(..)
     , InlineElement(..)
 
-    , ListElement(..)
+    , Definition(..)
+
     , ListType(..)
     , ListItem
 
-    , Definition(..)
-
     , CommandType(..)
-    , Attribute
     , BlockCommand(..)
     , InlineCommand(..)
     )
@@ -24,17 +26,30 @@ import           Rakka.Page
 type WikiPage = [BlockElement]
 
 
+data Element
+    = Block  !BlockElement
+    | Inline !InlineElement
+    deriving (Eq, Show, Typeable, Data)
+
+
+type Attribute = (String, String)
+
+
 data BlockElement
     = Heading {
         headingLevel :: !Int
       , headingText  :: !String
       }
     | HorizontalLine
-    | List !ListElement
+    | List {
+        listType  :: !ListType
+      , listItems :: ![ListItem]
+      }
     | DefinitionList ![Definition]
     | Preformatted ![InlineElement]
     | Paragraph ![InlineElement]
-    | Div ![Attribute] ![BlockElement]
+    | Div ![Attribute] ![Element]
+    | EmptyBlock
     | BlockCmd !BlockCommand
     deriving (Eq, Show, Typeable, Data)
 
@@ -43,6 +58,10 @@ data InlineElement
     = Text !String
     | Italic ![InlineElement]
     | Bold ![InlineElement]
+    | ObjectLink {
+        objLinkPage :: !PageName
+      , objLinkText :: !(Maybe String)
+      }
     | PageLink {
         linkPage     :: !(Maybe PageName)
       , linkFragment :: !(Maybe String)
@@ -54,27 +73,24 @@ data InlineElement
       }
     | LineBreak ![Attribute]
     | Span ![Attribute] ![InlineElement]
-    | Image ![Attribute]
+    | Image {
+        imgSource :: !(PageName)
+      , imgAlt    :: !(Maybe String)
+      }
     | Anchor ![Attribute] ![InlineElement]
+    | Input ![Attribute]
+    | EmptyInline
     | InlineCmd !InlineCommand
     deriving (Eq, Show, Typeable, Data)
 
 
-data ListElement
-    = ListElement {
-        listType  :: !ListType
-      , listItems :: ![ListItem]
-      }
-    deriving (Eq, Show, Typeable, Data)
-
-
 data ListType
     = Bullet
     | Numbered
     deriving (Eq, Show, Typeable, Data)
 
 
-type ListItem = [Either ListElement InlineElement]
+type ListItem = [Element]
 
 
 data Definition
@@ -91,9 +107,6 @@ data CommandType
     deriving (Eq, Show)
 
 
-type Attribute = (String, String)
-
-
 data BlockCommand
     = BlockCommand {
         bCmdName       :: !String