X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Rakka%2FWiki.hs;h=719ed62cc646699ebb4069a2bc1c6b51506b3de0;hb=859d4378c2e2a1ccc8028821a37eeaa43aaa23fb;hp=f8341ec8506d6069e4a152d4db50371b5bcaee1b;hpb=b3c3f333cd48bc74eb33f0f21d56a9d1bc65e0ea;p=Rakka.git diff --git a/Rakka/Wiki.hs b/Rakka/Wiki.hs index f8341ec..719ed62 100644 --- a/Rakka/Wiki.hs +++ b/Rakka/Wiki.hs @@ -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,23 @@ data InlineElement } | LineBreak ![Attribute] | Span ![Attribute] ![InlineElement] - | Image ![Attribute] + | Image { + imgSource :: !PageName + , imgAlt :: !(Maybe String) + } | 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] +type ListItem = [Element] data Definition @@ -91,9 +106,6 @@ data CommandType deriving (Eq, Show) -type Attribute = (String, String) - - data BlockCommand = BlockCommand { bCmdName :: !String