-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A parser and writer for org-mode flavored documents. -- -- -- `orgmode-parse` is a parsing and writing library for the org-mode -- flavor of document markup. -- -- This library parses the human-readable and textual representation into -- an AST that can be used for output to another format (HTML? -- Markdown?), serialized for storage, etc... @package orgmode-parse @version 0.0.2.1 -- | Types and utility functions for representing parsed org-mode -- documents. module Data.OrgMode.Parse.Types -- | An OrgMode heading. data Heading Heading :: Int -> Maybe Priority -> Maybe State -> Text -> [Keyword] -> Heading level :: Heading -> Int priority :: Heading -> Maybe Priority state :: Heading -> Maybe State title :: Heading -> Text keywords :: Heading -> [Keyword] -- | The priority of a heading item. -- -- A, B, and C correspond to the `[B]`, and `[#C]` -- syntax in OrgMode document headings. data Priority A :: Priority B :: Priority C :: Priority Unknown :: Priority -- | Convert text into a Priority value. toPriority :: Text -> Priority -- | The state of a heading (TODO, DONE, EVENT, etc...) newtype State State :: Text -> State -- | A keyword in a heading *not part of the property drawer*! newtype Keyword Keyword :: Text -> Keyword -- | The property drawer as an unordered HashMap. newtype PropertyDrawer k v PropertyDrawer :: (HashMap k v) -> PropertyDrawer k v -- | The "schedule" line. In OrgMode it must precede the heading -- immediately and can contain a SCHEDULED, DEADLINE, or -- none. No marker assumes the lonely timestamp is therefore an -- *appointment*. -- --
-- :PROPERTIES: -- :DATE: [2014-12-14 11:00] -- :NOTE: Something really crazy happened today! -- :END: --drawer :: Parser Text (PropertyDrawer Text Text) -- | Parse a property of a drawer. -- -- Properties *must* be a `:KEY: value` pair, the key can be of any case -- and contain any characters except for newlines and colons (since they -- delimit the start and end of the key). property :: Parser Text (Text, Text) -- | Parsing combinators for org-mode active and inactive timestamps. module Data.OrgMode.Parse.Attoparsec.Time -- | Parse an org-mode timestamp line with user-supplied opening and ending -- brackets (for either active or inactive stamps). parseTimestamp :: Open -> Close -> Parser Text (Maybe Schedule) -- | Parse the type of schedule. scheduleType :: Parser Text ScheduleType -- | Parsing combinators for org-list headings. module Data.OrgMode.Parse.Attoparsec.Headings -- | Parse an org-mode heading. heading :: Parser Text Heading -- | Parse the asterisk indicated heading level until a space is reached. headingLevel :: Parser Text Int -- | Parse the priority indicator. -- -- If anything but these priority indicators are used the parser will -- fail: `[B]`, `[#C]`. headingPriority :: Parser Text (Maybe Priority) -- | Title parser with alternative. -- -- This function tries to parse a title with a keyword and if it fails it -- then attempts to parse everything till the end of the line. headingTitle :: Parser Text (Text, Maybe Keyword) -- | Parse a heading keyword. -- -- You can use this with many' and catMaybes to get a list -- keywords: -- --
-- keys <- many' headingKeyword -- return $ catMaybes keys --headingKeyword :: Parser Text (Maybe Keyword) -- | Attoparsec parsers for org-mode documents. module Data.OrgMode.Parse