| Copyright | (c) Colin Woodbury 2020 - 2021 |
|---|---|
| License | BSD3 |
| Maintainer | Colin Woodbury <colin@fosskers.ca> |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Data.Org
Description
This library parses text in the Emacs Org Mode format.
Synopsis
- data OrgFile = OrgFile {}
- emptyOrgFile :: OrgFile
- data OrgDoc = OrgDoc {
- docBlocks :: [Block]
- docSections :: [Section]
- emptyDoc :: OrgDoc
- allDocTags :: OrgDoc -> Set Text
- data OrgDateTime = OrgDateTime {}
- data OrgTime = OrgTime {}
- data Repeater = Repeater {
- repMode :: RepeatMode
- repValue :: Word
- repInterval :: Interval
- data RepeatMode
- data Delay = Delay {}
- data DelayMode
- data Interval
- data Section = Section {
- sectionTodo :: Maybe Todo
- sectionPriority :: Maybe Priority
- sectionHeading :: NonEmpty Words
- sectionTags :: [Text]
- sectionClosed :: Maybe OrgDateTime
- sectionDeadline :: Maybe OrgDateTime
- sectionScheduled :: Maybe OrgDateTime
- sectionTimestamp :: Maybe OrgDateTime
- sectionProps :: Map Text Text
- sectionDoc :: OrgDoc
- titled :: Words -> Section
- allSectionTags :: Section -> Set Text
- data Todo
- newtype Priority = Priority {}
- data Block
- data Words
- data ListItems = ListItems ListType (NonEmpty Item)
- data ListType
- data Item = Item (NonEmpty Words) (Maybe ListItems)
- data Row
- data Column
- newtype URL = URL Text
- newtype Language = Language Text
- org :: Text -> Maybe OrgFile
- orgFile :: Parser OrgFile
- meta :: Parser (Map Text Text)
- orgP :: Parser OrgDoc
- section :: Int -> Parser Section
- properties :: Parser (Map Text Text)
- property :: Parser (Text, Text)
- paragraph :: Parser Block
- table :: Parser Block
- list :: Parser Block
- line :: Char -> Parser (NonEmpty Words)
- timestamp :: Parser OrgDateTime
- date :: Parser Day
- timeRange :: Parser OrgTime
- repeater :: Parser Repeater
- prettyOrgFile :: OrgFile -> Text
- prettyOrg :: OrgDoc -> Text
- prettyWords :: Words -> Text
Types
Top-level
A complete .org file with metadata.
Constructors
| OrgFile | |
Instances
| Generic OrgFile Source # | |
| Show OrgFile Source # | |
| Eq OrgFile Source # | |
| Ord OrgFile Source # | |
| type Rep OrgFile Source # | |
Defined in Data.Org type Rep OrgFile = D1 ('MetaData "OrgFile" "Data.Org" "org-mode-2.1.0-95X35dUG0rlKLHMjKot7mf" 'False) (C1 ('MetaCons "OrgFile" 'PrefixI 'True) (S1 ('MetaSel ('Just "orgMeta") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Text Text)) :*: S1 ('MetaSel ('Just "orgDoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 OrgDoc))) | |
A recursive Org document. These are zero or more blocks of markup, followed by zero or more subsections.
This is some top-level text. * Important heading ** Less important subheading
Constructors
| OrgDoc | |
Fields
| |
Instances
| Generic OrgDoc Source # | |
| Show OrgDoc Source # | |
| Eq OrgDoc Source # | |
| Ord OrgDoc Source # | |
| type Rep OrgDoc Source # | |
Defined in Data.Org type Rep OrgDoc = D1 ('MetaData "OrgDoc" "Data.Org" "org-mode-2.1.0-95X35dUG0rlKLHMjKot7mf" 'False) (C1 ('MetaCons "OrgDoc" 'PrefixI 'True) (S1 ('MetaSel ('Just "docBlocks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Block]) :*: S1 ('MetaSel ('Just "docSections") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Section]))) | |
allDocTags :: OrgDoc -> Set Text Source #
All unique section tags in the entire document.
Section tags appear on the same row as a header title, but right-aligned.
* This is a Heading :tag1:tag2:
Timestamps
data OrgDateTime Source #
An org-mode timestamp. Must contain at least a year-month-day and the day of the week:
<2021-04-27 Tue>
but also may contain a time:
<2021-04-27 Tue 12:00>
or a time range:
<2021-04-27 Tue 12:00-13:00>
and/or a repeater value:
<2021-04-27 Tue +1w>
Constructors
| OrgDateTime | |
Instances
| Show OrgDateTime Source # | |
Defined in Data.Org Methods showsPrec :: Int -> OrgDateTime -> ShowS # show :: OrgDateTime -> String # showList :: [OrgDateTime] -> ShowS # | |
| Eq OrgDateTime Source # | |
Defined in Data.Org | |
| Ord OrgDateTime Source # | A lack of a specific |
Defined in Data.Org Methods compare :: OrgDateTime -> OrgDateTime -> Ordering # (<) :: OrgDateTime -> OrgDateTime -> Bool # (<=) :: OrgDateTime -> OrgDateTime -> Bool # (>) :: OrgDateTime -> OrgDateTime -> Bool # (>=) :: OrgDateTime -> OrgDateTime -> Bool # max :: OrgDateTime -> OrgDateTime -> OrgDateTime # min :: OrgDateTime -> OrgDateTime -> OrgDateTime # | |
The time portion of the full timestamp. May be a range, as seen in the following full timestamp:
<2021-04-27 Tue 12:00-13:00>
An indication of how often a timestamp should be automatically reapplied in the Org Agenda.
Constructors
| Repeater | |
Fields
| |
data RepeatMode Source #
The nature of the repitition.
Constructors
| Single | Apply the interval value to the original timestamp once: |
| Jump | Apply the interval value as many times as necessary to arrive on a future date: |
| FromToday | Apply the interval value from today: |
Instances
| Show RepeatMode Source # | |
Defined in Data.Org Methods showsPrec :: Int -> RepeatMode -> ShowS # show :: RepeatMode -> String # showList :: [RepeatMode] -> ShowS # | |
| Eq RepeatMode Source # | |
Defined in Data.Org | |
| Ord RepeatMode Source # | |
Defined in Data.Org Methods compare :: RepeatMode -> RepeatMode -> Ordering # (<) :: RepeatMode -> RepeatMode -> Bool # (<=) :: RepeatMode -> RepeatMode -> Bool # (>) :: RepeatMode -> RepeatMode -> Bool # (>=) :: RepeatMode -> RepeatMode -> Bool # max :: RepeatMode -> RepeatMode -> RepeatMode # min :: RepeatMode -> RepeatMode -> RepeatMode # | |
Delay the appearance of a timestamp in the agenda.
Constructors
| Delay | |
Fields
| |
When a repeater is also present, should the delay be for the first value or all of them?
Instances
| Show DelayMode Source # | |
| Eq DelayMode Source # | |
| Ord DelayMode Source # | |
The timestamp repitition unit.
Markup
A subsection, marked by a heading line and followed recursively by an
OrgDoc.
* This is a Heading This is content in the sub ~OrgDoc~.
Constructors
| Section | |
Fields
| |
Instances
The completion state of a heading that is considered a "todo" item.
A priority value, usually associated with a TODO marking, as in:
*** TODO [#A] Cure cancer with Haskell *** TODO [#B] Eat lunch
Some logically distinct block of Org content.
Constructors
| Quote Text | |
| Example Text | |
| Code (Maybe Language) Text | |
| List ListItems | |
| Table (NonEmpty Row) | |
| Paragraph (NonEmpty Words) |
Instances
The fundamental unit of Org text content. Plain units are split
word-by-word.
Constructors
| Bold Text | |
| Italic Text | |
| Highlight Text | |
| Underline Text | |
| Verbatim Text | |
| Strike Text | |
| Link URL (Maybe Text) | |
| Image URL | |
| Punct Char | |
| Plain Text |
Instances
An org list constructed of - or + characters, or numbers.
1. Feed the cat - The good stuff 2. Feed the dog - He'll eat anything 3. Feed the bird 4. Feed the alligator 5. Feed the elephant
Instances
| Generic ListItems Source # | |
| Show ListItems Source # | |
| Eq ListItems Source # | |
| Ord ListItems Source # | |
| type Rep ListItems Source # | |
Defined in Data.Org type Rep ListItems = D1 ('MetaData "ListItems" "Data.Org" "org-mode-2.1.0-95X35dUG0rlKLHMjKot7mf" 'False) (C1 ('MetaCons "ListItems" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ListType) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty Item)))) | |
Instances
| Generic ListType Source # | |
| Show ListType Source # | |
| Eq ListType Source # | |
| Ord ListType Source # | |
Defined in Data.Org | |
| type Rep ListType Source # | |
Defined in Data.Org type Rep ListType = D1 ('MetaData "ListType" "Data.Org" "org-mode-2.1.0-95X35dUG0rlKLHMjKot7mf" 'False) (C1 ('MetaCons "Bulleted" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Plussed" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Numbered" 'PrefixI 'False) (U1 :: Type -> Type))) | |
A line in a bullet-list. Can contain sublists, as shown in ListItems.
Instances
| Generic Item Source # | |
| Show Item Source # | |
| Eq Item Source # | |
| Ord Item Source # | |
| type Rep Item Source # | |
Defined in Data.Org type Rep Item = D1 ('MetaData "Item" "Data.Org" "org-mode-2.1.0-95X35dUG0rlKLHMjKot7mf" 'False) (C1 ('MetaCons "Item" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty Words)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe ListItems)))) | |
A row in an org table. Can have content or be a horizontal rule.
| A | B | C | |---+---+---| | D | E | F |
Instances
| Generic Row Source # | |
| Show Row Source # | |
| Eq Row Source # | |
| Ord Row Source # | |
| type Rep Row Source # | |
Defined in Data.Org type Rep Row = D1 ('MetaData "Row" "Data.Org" "org-mode-2.1.0-95X35dUG0rlKLHMjKot7mf" 'False) (C1 ('MetaCons "Break" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Row" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty Column)))) | |
A possibly empty column in an org table.
Instances
| Generic Column Source # | |
| Show Column Source # | |
| Eq Column Source # | |
| Ord Column Source # | |
| type Rep Column Source # | |
Defined in Data.Org type Rep Column = D1 ('MetaData "Column" "Data.Org" "org-mode-2.1.0-95X35dUG0rlKLHMjKot7mf" 'False) (C1 ('MetaCons "Empty" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Column" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty Words)))) | |
The url portion of a link.
The programming language some source code block was written in.
Parsing
Internal Parsers
These are exposed for testing purposes.
timestamp :: Parser OrgDateTime Source #
Pretty Printing
prettyOrgFile :: OrgFile -> Text Source #
prettyWords :: Words -> Text Source #