X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Rakka%2FWiki.hs;h=a519d34a227da9b8a40ec6db7b66108907185fc2;hb=f57c5c5ae6c95e68b11400718e7ce5de4ea1317a;hp=f0e38fedd47994f629efdd6ae1f2dbe74ac4b784;hpb=7c3065043cdfbd96539a9bf6bff9b1d4281c0b2a;p=Rakka.git diff --git a/Rakka/Wiki.hs b/Rakka/Wiki.hs index f0e38fe..a519d34 100644 --- a/Rakka/Wiki.hs +++ b/Rakka/Wiki.hs @@ -1,38 +1,54 @@ module Rakka.Wiki ( WikiPage + + , Element(..) + , Attribute + , BlockElement(..) , InlineElement(..) - , ListElement(..) + , Definition(..) + , ListType(..) , ListItem - , Definition(..) - , CommandType(..) - , Attribute , BlockCommand(..) , InlineCommand(..) ) where +import Network.URI import Rakka.Page type WikiPage = [BlockElement] +data Element + = Block !BlockElement + | Inline !InlineElement + deriving (Eq, Show) + + +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) @@ -41,34 +57,39 @@ 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 ![Attribute] + | Image { + imgSource :: !(Either URI PageName) + , imgAlt :: !(Maybe String) + } | Anchor ![Attribute] ![InlineElement] + | Input ![Attribute] + | EmptyInline | InlineCmd !InlineCommand deriving (Eq, Show) -data ListElement - = ListElement { - listType :: !ListType - , listItems :: ![ListItem] - } - deriving (Eq, Show) - - data ListType = Bullet | Numbered deriving (Eq, Show) -type ListItem = [Either ListElement InlineElement] +type ListItem = [Element] data Definition @@ -82,9 +103,7 @@ data Definition data CommandType = InlineCommandType | BlockCommandType - - -type Attribute = (String, String) + deriving (Eq, Show) data BlockCommand