X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;ds=inline;f=Rakka%2FWiki.hs;h=0fcf38a6bca33b31550bb2ddbc8d5d49f37a19e7;hb=605a843e408a7ef475fbb5a26f408271ab315cc8;hp=c5c2c68ec1b12b19e62bb73b85b81a5f96bc3ca2;hpb=1647278f9393f7382b6e8b8a5e9e14ce50aae718;p=Rakka.git diff --git a/Rakka/Wiki.hs b/Rakka/Wiki.hs index c5c2c68..0fcf38a 100644 --- a/Rakka/Wiki.hs +++ b/Rakka/Wiki.hs @@ -1,21 +1,27 @@ module Rakka.Wiki ( WikiPage - , WikiElement(..) , BlockElement(..) , InlineElement(..) + + , ListElement(..) + , ListType(..) + , ListItem + + , Definition(..) + + , CommandType(..) + , Attribute + , BlockCommand(..) + , InlineCommand(..) ) where +import Data.Generics +import Network.URI import Rakka.Page -type WikiPage = [WikiElement] - - -data WikiElement - = Block !BlockElement - | Inline !InlineElement - deriving (Eq, Show) +type WikiPage = [BlockElement] data BlockElement @@ -23,15 +29,86 @@ data BlockElement headingLevel :: !Int , headingText :: !String } - | EmptyLine - deriving (Eq, Show) + | HorizontalLine + | List !ListElement + | DefinitionList ![Definition] + | Preformatted ![InlineElement] + | Paragraph ![InlineElement] + | Div ![Attribute] ![BlockElement] + | EmptyBlock + | BlockCmd !BlockCommand + deriving (Eq, Show, Typeable, Data) data InlineElement = Text !String + | Italic ![InlineElement] + | Bold ![InlineElement] | PageLink { linkPage :: !(Maybe PageName) , linkFragment :: !(Maybe String) , linkText :: !(Maybe String) } + | ExternalLink { + extLinkURI :: !URI + , extLinkText :: !(Maybe String) + } + | LineBreak ![Attribute] + | Span ![Attribute] ![InlineElement] + | Image ![Attribute] + | Anchor ![Attribute] ![InlineElement] + | 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] + + +data Definition + = Definition { + defTerm :: ![InlineElement] + , defDesc :: ![InlineElement] + } + deriving (Eq, Show, Typeable, Data) + + +data CommandType + = InlineCommandType + | BlockCommandType deriving (Eq, Show) + + +type Attribute = (String, String) + + +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)