org-mode-2.1.0: Parser for Emacs org-mode files.
Copyright(c) Colin Woodbury 2020 - 2021
LicenseBSD3
MaintainerColin Woodbury <colin@fosskers.ca>
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Org

Description

This library parses text in the Emacs Org Mode format.

Use the org function to parse a Text value.

Synopsis

Types

Top-level

data OrgFile Source #

A complete .org file with metadata.

Constructors

OrgFile 

Fields

Instances

Instances details
Generic OrgFile Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep OrgFile :: Type -> Type #

Methods

from :: OrgFile -> Rep OrgFile x #

to :: Rep OrgFile x -> OrgFile #

Show OrgFile Source # 
Instance details

Defined in Data.Org

Eq OrgFile Source # 
Instance details

Defined in Data.Org

Methods

(==) :: OrgFile -> OrgFile -> Bool #

(/=) :: OrgFile -> OrgFile -> Bool #

Ord OrgFile Source # 
Instance details

Defined in Data.Org

type Rep OrgFile Source # 
Instance details

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)))

data OrgDoc Source #

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

Instances details
Generic OrgDoc Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep OrgDoc :: Type -> Type #

Methods

from :: OrgDoc -> Rep OrgDoc x #

to :: Rep OrgDoc x -> OrgDoc #

Show OrgDoc Source # 
Instance details

Defined in Data.Org

Eq OrgDoc Source # 
Instance details

Defined in Data.Org

Methods

(==) :: OrgDoc -> OrgDoc -> Bool #

(/=) :: OrgDoc -> OrgDoc -> Bool #

Ord OrgDoc Source # 
Instance details

Defined in Data.Org

type Rep OrgDoc Source # 
Instance details

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>

Instances

Instances details
Show OrgDateTime Source # 
Instance details

Defined in Data.Org

Eq OrgDateTime Source # 
Instance details

Defined in Data.Org

Ord OrgDateTime Source #

A lack of a specific OrgTime is assumed to mean 00:00, the earliest possible time for that day.

Instance details

Defined in Data.Org

data OrgTime Source #

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>

Constructors

OrgTime 

Instances

Instances details
Show OrgTime Source # 
Instance details

Defined in Data.Org

Eq OrgTime Source # 
Instance details

Defined in Data.Org

Methods

(==) :: OrgTime -> OrgTime -> Bool #

(/=) :: OrgTime -> OrgTime -> Bool #

Ord OrgTime Source # 
Instance details

Defined in Data.Org

data Repeater Source #

An indication of how often a timestamp should be automatically reapplied in the Org Agenda.

Constructors

Repeater 

Instances

Instances details
Show Repeater Source # 
Instance details

Defined in Data.Org

Eq Repeater Source # 
Instance details

Defined in Data.Org

Ord Repeater Source # 
Instance details

Defined in Data.Org

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

Instances details
Show RepeatMode Source # 
Instance details

Defined in Data.Org

Eq RepeatMode Source # 
Instance details

Defined in Data.Org

Ord RepeatMode Source # 
Instance details

Defined in Data.Org

data Delay Source #

Delay the appearance of a timestamp in the agenda.

Instances

Instances details
Show Delay Source # 
Instance details

Defined in Data.Org

Methods

showsPrec :: Int -> Delay -> ShowS #

show :: Delay -> String #

showList :: [Delay] -> ShowS #

Eq Delay Source # 
Instance details

Defined in Data.Org

Methods

(==) :: Delay -> Delay -> Bool #

(/=) :: Delay -> Delay -> Bool #

Ord Delay Source # 
Instance details

Defined in Data.Org

Methods

compare :: Delay -> Delay -> Ordering #

(<) :: Delay -> Delay -> Bool #

(<=) :: Delay -> Delay -> Bool #

(>) :: Delay -> Delay -> Bool #

(>=) :: Delay -> Delay -> Bool #

max :: Delay -> Delay -> Delay #

min :: Delay -> Delay -> Delay #

data DelayMode Source #

When a repeater is also present, should the delay be for the first value or all of them?

Constructors

DelayOne

As in: --2d

DelayAll

As in: -2d

Instances

Instances details
Show DelayMode Source # 
Instance details

Defined in Data.Org

Eq DelayMode Source # 
Instance details

Defined in Data.Org

Ord DelayMode Source # 
Instance details

Defined in Data.Org

data Interval Source #

The timestamp repitition unit.

Constructors

Hour 
Day 
Week 
Month 
Year 

Instances

Instances details
Show Interval Source # 
Instance details

Defined in Data.Org

Eq Interval Source # 
Instance details

Defined in Data.Org

Ord Interval Source # 
Instance details

Defined in Data.Org

Markup

data Section Source #

A subsection, marked by a heading line and followed recursively by an OrgDoc.

* This is a Heading

This is content in the sub ~OrgDoc~.

Instances

Instances details
Generic Section Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep Section :: Type -> Type #

Methods

from :: Section -> Rep Section x #

to :: Rep Section x -> Section #

Show Section Source # 
Instance details

Defined in Data.Org

Eq Section Source # 
Instance details

Defined in Data.Org

Methods

(==) :: Section -> Section -> Bool #

(/=) :: Section -> Section -> Bool #

Ord Section Source # 
Instance details

Defined in Data.Org

type Rep Section Source # 
Instance details

Defined in Data.Org

titled :: Words -> Section Source #

A mostly empty invoking of a Section.

allSectionTags :: Section -> Set Text Source #

All unique tags with a section and its subsections.

data Todo Source #

The completion state of a heading that is considered a "todo" item.

Constructors

TODO 
DONE 

Instances

Instances details
Generic Todo Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep Todo :: Type -> Type #

Methods

from :: Todo -> Rep Todo x #

to :: Rep Todo x -> Todo #

Show Todo Source # 
Instance details

Defined in Data.Org

Methods

showsPrec :: Int -> Todo -> ShowS #

show :: Todo -> String #

showList :: [Todo] -> ShowS #

Eq Todo Source # 
Instance details

Defined in Data.Org

Methods

(==) :: Todo -> Todo -> Bool #

(/=) :: Todo -> Todo -> Bool #

Ord Todo Source # 
Instance details

Defined in Data.Org

Methods

compare :: Todo -> Todo -> Ordering #

(<) :: Todo -> Todo -> Bool #

(<=) :: Todo -> Todo -> Bool #

(>) :: Todo -> Todo -> Bool #

(>=) :: Todo -> Todo -> Bool #

max :: Todo -> Todo -> Todo #

min :: Todo -> Todo -> Todo #

type Rep Todo Source # 
Instance details

Defined in Data.Org

type Rep Todo = D1 ('MetaData "Todo" "Data.Org" "org-mode-2.1.0-95X35dUG0rlKLHMjKot7mf" 'False) (C1 ('MetaCons "TODO" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DONE" 'PrefixI 'False) (U1 :: Type -> Type))

newtype Priority Source #

A priority value, usually associated with a TODO marking, as in:

*** TODO [#A] Cure cancer with Haskell
*** TODO [#B] Eat lunch

Constructors

Priority 

Fields

Instances

Instances details
Generic Priority Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep Priority :: Type -> Type #

Methods

from :: Priority -> Rep Priority x #

to :: Rep Priority x -> Priority #

Show Priority Source # 
Instance details

Defined in Data.Org

Eq Priority Source # 
Instance details

Defined in Data.Org

Ord Priority Source # 
Instance details

Defined in Data.Org

type Rep Priority Source # 
Instance details

Defined in Data.Org

type Rep Priority = D1 ('MetaData "Priority" "Data.Org" "org-mode-2.1.0-95X35dUG0rlKLHMjKot7mf" 'True) (C1 ('MetaCons "Priority" 'PrefixI 'True) (S1 ('MetaSel ('Just "priority") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

data Block Source #

Some logically distinct block of Org content.

Instances

Instances details
Generic Block Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep Block :: Type -> Type #

Methods

from :: Block -> Rep Block x #

to :: Rep Block x -> Block #

Show Block Source # 
Instance details

Defined in Data.Org

Methods

showsPrec :: Int -> Block -> ShowS #

show :: Block -> String #

showList :: [Block] -> ShowS #

Eq Block Source # 
Instance details

Defined in Data.Org

Methods

(==) :: Block -> Block -> Bool #

(/=) :: Block -> Block -> Bool #

Ord Block Source # 
Instance details

Defined in Data.Org

Methods

compare :: Block -> Block -> Ordering #

(<) :: Block -> Block -> Bool #

(<=) :: Block -> Block -> Bool #

(>) :: Block -> Block -> Bool #

(>=) :: Block -> Block -> Bool #

max :: Block -> Block -> Block #

min :: Block -> Block -> Block #

type Rep Block Source # 
Instance details

Defined in Data.Org

data Words Source #

The fundamental unit of Org text content. Plain units are split word-by-word.

Instances

Instances details
Generic Words Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep Words :: Type -> Type #

Methods

from :: Words -> Rep Words x #

to :: Rep Words x -> Words #

Show Words Source # 
Instance details

Defined in Data.Org

Methods

showsPrec :: Int -> Words -> ShowS #

show :: Words -> String #

showList :: [Words] -> ShowS #

Eq Words Source # 
Instance details

Defined in Data.Org

Methods

(==) :: Words -> Words -> Bool #

(/=) :: Words -> Words -> Bool #

Ord Words Source # 
Instance details

Defined in Data.Org

Methods

compare :: Words -> Words -> Ordering #

(<) :: Words -> Words -> Bool #

(<=) :: Words -> Words -> Bool #

(>) :: Words -> Words -> Bool #

(>=) :: Words -> Words -> Bool #

max :: Words -> Words -> Words #

min :: Words -> Words -> Words #

Hashable Words Source # 
Instance details

Defined in Data.Org

Methods

hashWithSalt :: Int -> Words -> Int #

hash :: Words -> Int #

type Rep Words Source # 
Instance details

Defined in Data.Org

type Rep Words = D1 ('MetaData "Words" "Data.Org" "org-mode-2.1.0-95X35dUG0rlKLHMjKot7mf" 'False) (((C1 ('MetaCons "Bold" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "Italic" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) :+: (C1 ('MetaCons "Highlight" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: (C1 ('MetaCons "Underline" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "Verbatim" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))))) :+: ((C1 ('MetaCons "Strike" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :+: C1 ('MetaCons "Link" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 URL) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)))) :+: (C1 ('MetaCons "Image" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 URL)) :+: (C1 ('MetaCons "Punct" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char)) :+: C1 ('MetaCons "Plain" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))))))

data ListItems Source #

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

Instances details
Generic ListItems Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep ListItems :: Type -> Type #

Show ListItems Source # 
Instance details

Defined in Data.Org

Eq ListItems Source # 
Instance details

Defined in Data.Org

Ord ListItems Source # 
Instance details

Defined in Data.Org

type Rep ListItems Source # 
Instance details

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))))

data ListType Source #

Constructors

Bulleted 
Plussed 
Numbered 

Instances

Instances details
Generic ListType Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep ListType :: Type -> Type #

Methods

from :: ListType -> Rep ListType x #

to :: Rep ListType x -> ListType #

Show ListType Source # 
Instance details

Defined in Data.Org

Eq ListType Source # 
Instance details

Defined in Data.Org

Ord ListType Source # 
Instance details

Defined in Data.Org

type Rep ListType Source # 
Instance details

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)))

data Item Source #

A line in a bullet-list. Can contain sublists, as shown in ListItems.

Constructors

Item (NonEmpty Words) (Maybe ListItems) 

Instances

Instances details
Generic Item Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep Item :: Type -> Type #

Methods

from :: Item -> Rep Item x #

to :: Rep Item x -> Item #

Show Item Source # 
Instance details

Defined in Data.Org

Methods

showsPrec :: Int -> Item -> ShowS #

show :: Item -> String #

showList :: [Item] -> ShowS #

Eq Item Source # 
Instance details

Defined in Data.Org

Methods

(==) :: Item -> Item -> Bool #

(/=) :: Item -> Item -> Bool #

Ord Item Source # 
Instance details

Defined in Data.Org

Methods

compare :: Item -> Item -> Ordering #

(<) :: Item -> Item -> Bool #

(<=) :: Item -> Item -> Bool #

(>) :: Item -> Item -> Bool #

(>=) :: Item -> Item -> Bool #

max :: Item -> Item -> Item #

min :: Item -> Item -> Item #

type Rep Item Source # 
Instance details

Defined in Data.Org

data Row Source #

A row in an org table. Can have content or be a horizontal rule.

| A | B | C |
|---+---+---|
| D | E | F |

Constructors

Break 
Row (NonEmpty Column) 

Instances

Instances details
Generic Row Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep Row :: Type -> Type #

Methods

from :: Row -> Rep Row x #

to :: Rep Row x -> Row #

Show Row Source # 
Instance details

Defined in Data.Org

Methods

showsPrec :: Int -> Row -> ShowS #

show :: Row -> String #

showList :: [Row] -> ShowS #

Eq Row Source # 
Instance details

Defined in Data.Org

Methods

(==) :: Row -> Row -> Bool #

(/=) :: Row -> Row -> Bool #

Ord Row Source # 
Instance details

Defined in Data.Org

Methods

compare :: Row -> Row -> Ordering #

(<) :: Row -> Row -> Bool #

(<=) :: Row -> Row -> Bool #

(>) :: Row -> Row -> Bool #

(>=) :: Row -> Row -> Bool #

max :: Row -> Row -> Row #

min :: Row -> Row -> Row #

type Rep Row Source # 
Instance details

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))))

data Column Source #

A possibly empty column in an org table.

Constructors

Empty 
Column (NonEmpty Words) 

Instances

Instances details
Generic Column Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep Column :: Type -> Type #

Methods

from :: Column -> Rep Column x #

to :: Rep Column x -> Column #

Show Column Source # 
Instance details

Defined in Data.Org

Eq Column Source # 
Instance details

Defined in Data.Org

Methods

(==) :: Column -> Column -> Bool #

(/=) :: Column -> Column -> Bool #

Ord Column Source # 
Instance details

Defined in Data.Org

type Rep Column Source # 
Instance details

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))))

newtype URL Source #

The url portion of a link.

Constructors

URL Text 

Instances

Instances details
Generic URL Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep URL :: Type -> Type #

Methods

from :: URL -> Rep URL x #

to :: Rep URL x -> URL #

Show URL Source # 
Instance details

Defined in Data.Org

Methods

showsPrec :: Int -> URL -> ShowS #

show :: URL -> String #

showList :: [URL] -> ShowS #

Eq URL Source # 
Instance details

Defined in Data.Org

Methods

(==) :: URL -> URL -> Bool #

(/=) :: URL -> URL -> Bool #

Ord URL Source # 
Instance details

Defined in Data.Org

Methods

compare :: URL -> URL -> Ordering #

(<) :: URL -> URL -> Bool #

(<=) :: URL -> URL -> Bool #

(>) :: URL -> URL -> Bool #

(>=) :: URL -> URL -> Bool #

max :: URL -> URL -> URL #

min :: URL -> URL -> URL #

Hashable URL Source # 
Instance details

Defined in Data.Org

Methods

hashWithSalt :: Int -> URL -> Int #

hash :: URL -> Int #

type Rep URL Source # 
Instance details

Defined in Data.Org

type Rep URL = D1 ('MetaData "URL" "Data.Org" "org-mode-2.1.0-95X35dUG0rlKLHMjKot7mf" 'True) (C1 ('MetaCons "URL" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

newtype Language Source #

The programming language some source code block was written in.

Constructors

Language Text 

Instances

Instances details
Generic Language Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep Language :: Type -> Type #

Methods

from :: Language -> Rep Language x #

to :: Rep Language x -> Language #

Show Language Source # 
Instance details

Defined in Data.Org

Eq Language Source # 
Instance details

Defined in Data.Org

Ord Language Source # 
Instance details

Defined in Data.Org

type Rep Language Source # 
Instance details

Defined in Data.Org

type Rep Language = D1 ('MetaData "Language" "Data.Org" "org-mode-2.1.0-95X35dUG0rlKLHMjKot7mf" 'True) (C1 ('MetaCons "Language" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

Parsing

org :: Text -> Maybe OrgFile Source #

Attempt to parse an OrgFile.

Internal Parsers

These are exposed for testing purposes.

meta :: Parser (Map Text Text) Source #

orgP :: Parser OrgDoc Source #

section :: Int -> Parser Section Source #

property :: Parser (Text, Text) Source #

table :: Parser Block Source #

list :: Parser Block Source #

line :: Char -> Parser (NonEmpty Words) Source #

date :: Parser Day Source #

Pretty Printing