-- 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*. -- -- -- -- Recurring time intervals are also possible and are not parsed right -- now but are kept in the recurring field. data Schedule Schedule :: ScheduleType -> Maybe Timestamp -> Maybe Text -> Schedule schedule_type :: Schedule -> ScheduleType timestamp :: Schedule -> Maybe Timestamp recurring :: Schedule -> Maybe Text -- | The schedule value, no value (or a failed parse) will result in simply -- the APPOINTMENT value. data ScheduleType SCHEDULED :: ScheduleType DEADLINE :: ScheduleType APPOINTMENT :: ScheduleType -- | An active or inactive timestamp as LocalTime. data Timestamp Active :: LocalTime -> Timestamp Inactive :: LocalTime -> Timestamp -- | So we don't get confused when passing the opening and closing -- characters to the timestamp parser. newtype Open Open :: Char -> Open newtype Close Close :: Char -> Close instance Show Priority instance Read Priority instance Eq Priority instance Ord Priority instance Show State instance Eq State instance Show Keyword instance Eq Keyword instance Ord Keyword instance Show Heading instance Eq Heading instance (Show k, Show v) => Show (PropertyDrawer k v) instance (Eq k, Eq v) => Eq (PropertyDrawer k v) instance Show ScheduleType instance Eq ScheduleType instance Show Timestamp instance Eq Timestamp instance Show Schedule instance Eq Schedule -- | Parsing combinators for org-mode entry property drawers. module Data.OrgMode.Parse.Attoparsec.PropertyDrawer -- | Parse a property drawer. -- --
--   :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