]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Wiki.hs
Wrote many...
[Rakka.git] / Rakka / Wiki.hs
index c5c2c68ec1b12b19e62bb73b85b81a5f96bc3ca2..719ed62cc646699ebb4069a2bc1c6b51506b3de0 100644 (file)
@@ -1,21 +1,38 @@
 module Rakka.Wiki
     ( WikiPage
-    , WikiElement(..)
+
+    , Element(..)
+    , Attribute
+
     , BlockElement(..)
     , InlineElement(..)
+
+    , Definition(..)
+
+    , ListType(..)
+    , ListItem
+
+    , CommandType(..)
+    , BlockCommand(..)
+    , InlineCommand(..)
     )
     where
 
+import           Data.Generics
+import           Network.URI
 import           Rakka.Page
 
 
-type WikiPage = [WikiElement]
+type WikiPage = [BlockElement]
 
 
-data WikiElement
-    = Block !BlockElement
+data Element
+    = Block  !BlockElement
     | Inline !InlineElement
-    deriving (Eq, Show)
+    deriving (Eq, Show, Typeable, Data)
+
+
+type Attribute = (String, String)
 
 
 data BlockElement
@@ -23,15 +40,85 @@ data BlockElement
         headingLevel :: !Int
       , headingText  :: !String
       }
-    | EmptyLine
-    deriving (Eq, Show)
+    | HorizontalLine
+    | List {
+        listType  :: !ListType
+      , listItems :: ![ListItem]
+      }
+    | DefinitionList ![Definition]
+    | Preformatted ![InlineElement]
+    | Paragraph ![InlineElement]
+    | Div ![Attribute] ![Element]
+    | EmptyBlock
+    | BlockCmd !BlockCommand
+    deriving (Eq, Show, Typeable, Data)
 
 
 data InlineElement
     = Text !String
+    | Italic ![InlineElement]
+    | Bold ![InlineElement]
+    | ObjectLink {
+        objLinkPage :: !PageName
+      , objLinkText :: !(Maybe String)
+      }
     | PageLink {
         linkPage     :: !(Maybe PageName)
       , linkFragment :: !(Maybe String)
       , linkText     :: !(Maybe String)
       }
+    | ExternalLink {
+        extLinkURI  :: !URI
+      , extLinkText :: !(Maybe String)
+      }
+    | LineBreak ![Attribute]
+    | Span ![Attribute] ![InlineElement]
+    | Image {
+        imgSource :: !PageName
+      , imgAlt    :: !(Maybe String)
+      }
+    | Anchor ![Attribute] ![InlineElement]
+    | EmptyInline
+    | InlineCmd !InlineCommand
+    deriving (Eq, Show, Typeable, Data)
+
+
+data ListType
+    = Bullet
+    | Numbered
+    deriving (Eq, Show, Typeable, Data)
+
+
+type ListItem = [Element]
+
+
+data Definition
+    = Definition {
+        defTerm :: ![InlineElement]
+      , defDesc :: ![InlineElement]
+      }
+    deriving (Eq, Show, Typeable, Data)
+
+
+data CommandType
+    = InlineCommandType
+    | BlockCommandType
     deriving (Eq, Show)
+
+
+data BlockCommand
+    = BlockCommand {
+        bCmdName       :: !String
+      , bCmdAttributes :: ![Attribute]
+      , bCmdContents   :: ![BlockElement]
+      }
+    deriving (Eq, Show, Typeable, Data)
+
+
+data InlineCommand
+    = InlineCommand {
+        iCmdName       :: !String
+      , iCmdAttributes :: ![Attribute]
+      , iCmdContents   :: ![InlineElement]
+      }
+    deriving (Eq, Show, Typeable, Data)