org-mode-1.0.1

Copyright(c) Colin Woodbury 2020
LicenseBSD3
MaintainerColin Woodbury <colin@fosskers.ca>
Safe HaskellNone
LanguageHaskell2010

Data.Org

Contents

Description

This library parses text in the Emacs Org Mode format.

Use the org function to parse a Text value.

Synopsis

Types

data OrgFile Source #

A complete .org file with metadata.

Constructors

OrgFile 

Fields

Instances
Eq OrgFile Source # 
Instance details

Defined in Data.Org

Methods

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

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

Show OrgFile Source # 
Instance details

Defined in Data.Org

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 #

type Rep OrgFile Source # 
Instance details

Defined in Data.Org

type Rep OrgFile = D1 (MetaData "OrgFile" "Data.Org" "org-mode-1.0.1-94JShmsJNw9678GWopnE9B" False) (C1 (MetaCons "OrgFile" PrefixI True) (S1 (MetaSel (Just "orgMeta") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Meta) :*: S1 (MetaSel (Just "orgDoc") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 OrgDoc)))

data Meta Source #

Top-level fields like:

#+TITLE: Curing Cancer with Haskell
#+DATE: 2020-02-25
#+AUTHOR: Colin
Instances
Eq Meta Source # 
Instance details

Defined in Data.Org

Methods

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

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

Show Meta Source # 
Instance details

Defined in Data.Org

Methods

showsPrec :: Int -> Meta -> ShowS #

show :: Meta -> String #

showList :: [Meta] -> ShowS #

Generic Meta Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep Meta :: Type -> Type #

Methods

from :: Meta -> Rep Meta x #

to :: Rep Meta x -> Meta #

type Rep Meta Source # 
Instance details

Defined in Data.Org

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
Eq OrgDoc Source # 
Instance details

Defined in Data.Org

Methods

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

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

Show OrgDoc Source # 
Instance details

Defined in Data.Org

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 #

Hashable OrgDoc Source # 
Instance details

Defined in Data.Org

Methods

hashWithSalt :: Int -> OrgDoc -> Int #

hash :: OrgDoc -> Int #

type Rep OrgDoc Source # 
Instance details

Defined in Data.Org

type Rep OrgDoc = D1 (MetaData "OrgDoc" "Data.Org" "org-mode-1.0.1-94JShmsJNw9678GWopnE9B" False) (C1 (MetaCons "OrgDoc" PrefixI True) (S1 (MetaSel (Just "docBlocks") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Block]) :*: S1 (MetaSel (Just "docSections") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Section])))

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
Eq Section Source # 
Instance details

Defined in Data.Org

Methods

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

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

Show Section Source # 
Instance details

Defined in Data.Org

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 #

Hashable Section Source # 
Instance details

Defined in Data.Org

Methods

hashWithSalt :: Int -> Section -> Int #

hash :: Section -> Int #

type Rep Section Source # 
Instance details

Defined in Data.Org

type Rep Section = D1 (MetaData "Section" "Data.Org" "org-mode-1.0.1-94JShmsJNw9678GWopnE9B" False) (C1 (MetaCons "Section" PrefixI True) (S1 (MetaSel (Just "sectionHeading") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NonEmpty Words)) :*: S1 (MetaSel (Just "sectionDoc") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 OrgDoc)))

data Block Source #

Some logically distinct block of Org content.

Instances
Eq Block Source # 
Instance details

Defined in Data.Org

Methods

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

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

Show Block Source # 
Instance details

Defined in Data.Org

Methods

showsPrec :: Int -> Block -> ShowS #

show :: Block -> String #

showList :: [Block] -> ShowS #

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 #

Hashable Block Source # 
Instance details

Defined in Data.Org

Methods

hashWithSalt :: Int -> Block -> Int #

hash :: Block -> Int #

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
Eq Words Source # 
Instance details

Defined in Data.Org

Methods

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

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

Show Words Source # 
Instance details

Defined in Data.Org

Methods

showsPrec :: Int -> Words -> ShowS #

show :: Words -> String #

showList :: [Words] -> ShowS #

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 #

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-1.0.1-94JShmsJNw9678GWopnE9B" 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))))))

newtype ListItems Source #

An org list constructed of - characters.

- Feed the cat
  - The good stuff
- Feed the dog
  - He'll eat anything
- Feed the bird
- Feed the alligator
- Feed the elephant

Constructors

ListItems (NonEmpty Item) 
Instances
Eq ListItems Source # 
Instance details

Defined in Data.Org

Show ListItems Source # 
Instance details

Defined in Data.Org

Generic ListItems Source # 
Instance details

Defined in Data.Org

Associated Types

type Rep ListItems :: Type -> Type #

Hashable 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-1.0.1-94JShmsJNw9678GWopnE9B" True) (C1 (MetaCons "ListItems" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NonEmpty Item))))

data Item Source #

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

Constructors

Item (NonEmpty Words) (Maybe ListItems) 
Instances
Eq Item Source # 
Instance details

Defined in Data.Org

Methods

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

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

Show Item Source # 
Instance details

Defined in Data.Org

Methods

showsPrec :: Int -> Item -> ShowS #

show :: Item -> String #

showList :: [Item] -> ShowS #

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 #

Hashable Item Source # 
Instance details

Defined in Data.Org

Methods

hashWithSalt :: Int -> Item -> Int #

hash :: Item -> Int #

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
Eq Row Source # 
Instance details

Defined in Data.Org

Methods

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

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

Show Row Source # 
Instance details

Defined in Data.Org

Methods

showsPrec :: Int -> Row -> ShowS #

show :: Row -> String #

showList :: [Row] -> ShowS #

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 #

Hashable Row Source # 
Instance details

Defined in Data.Org

Methods

hashWithSalt :: Int -> Row -> Int #

hash :: Row -> Int #

type Rep Row Source # 
Instance details

Defined in Data.Org

type Rep Row = D1 (MetaData "Row" "Data.Org" "org-mode-1.0.1-94JShmsJNw9678GWopnE9B" 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
Eq Column Source # 
Instance details

Defined in Data.Org

Methods

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

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

Show Column Source # 
Instance details

Defined in Data.Org

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 #

Hashable Column Source # 
Instance details

Defined in Data.Org

Methods

hashWithSalt :: Int -> Column -> Int #

hash :: Column -> Int #

type Rep Column Source # 
Instance details

Defined in Data.Org

type Rep Column = D1 (MetaData "Column" "Data.Org" "org-mode-1.0.1-94JShmsJNw9678GWopnE9B" 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
Eq URL Source # 
Instance details

Defined in Data.Org

Methods

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

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

Show URL Source # 
Instance details

Defined in Data.Org

Methods

showsPrec :: Int -> URL -> ShowS #

show :: URL -> String #

showList :: [URL] -> ShowS #

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 #

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-1.0.1-94JShmsJNw9678GWopnE9B" 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
Eq Language Source # 
Instance details

Defined in Data.Org

Show Language Source # 
Instance details

Defined in Data.Org

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 #

Hashable Language Source # 
Instance details

Defined in Data.Org

Methods

hashWithSalt :: Int -> Language -> Int #

hash :: Language -> Int #

type Rep Language Source # 
Instance details

Defined in Data.Org

type Rep Language = D1 (MetaData "Language" "Data.Org" "org-mode-1.0.1-94JShmsJNw9678GWopnE9B" 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 Meta Source #

orgP :: Parser OrgDoc Source #

section :: Int -> Parser Section Source #

table :: Parser Block Source #

list :: Parser Block Source #

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

Pretty Printing