Copyright | (c) Colin Woodbury 2020 |
---|---|
License | BSD3 |
Maintainer | Colin Woodbury <colin@fosskers.ca> |
Safe Haskell | None |
Language | Haskell2010 |
This library parses text in the Emacs Org Mode format.
Synopsis
- data OrgFile = OrgFile {}
- emptyOrgFile :: OrgFile
- data Meta = Meta {
- metaTitle :: Maybe Text
- metaDate :: Maybe Day
- metaAuthor :: Maybe Text
- metaHtmlHead :: Maybe Text
- metaOptions :: Maybe Text
- emptyMeta :: Meta
- data OrgDoc = OrgDoc {
- docBlocks :: [Block]
- docSections :: [Section]
- emptyDoc :: OrgDoc
- data Section = Section {}
- data Block
- data Words
- newtype ListItems = ListItems (NonEmpty Item)
- 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 Meta
- orgP :: Parser OrgDoc
- section :: Int -> Parser Section
- paragraph :: Parser Block
- table :: Parser Block
- list :: Parser Block
- line :: Char -> Parser (NonEmpty Words)
- prettyOrgFile :: OrgFile -> Text
- prettyOrg :: OrgDoc -> Text
- prettyWords :: Words -> Text
Types
A complete .org
file with metadata.
Instances
Eq OrgFile Source # | |
Show OrgFile Source # | |
Generic OrgFile Source # | |
type Rep OrgFile Source # | |
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))) |
Top-level fields like:
#+TITLE: Curing Cancer with Haskell #+DATE: 2020-02-25 #+AUTHOR: Colin
Meta | |
|
Instances
Eq Meta Source # | |
Show Meta Source # | |
Generic Meta Source # | |
type Rep Meta Source # | |
Defined in Data.Org type Rep Meta = D1 (MetaData "Meta" "Data.Org" "org-mode-1.0.1-94JShmsJNw9678GWopnE9B" False) (C1 (MetaCons "Meta" PrefixI True) ((S1 (MetaSel (Just "metaTitle") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text)) :*: S1 (MetaSel (Just "metaDate") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Day))) :*: (S1 (MetaSel (Just "metaAuthor") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text)) :*: (S1 (MetaSel (Just "metaHtmlHead") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text)) :*: S1 (MetaSel (Just "metaOptions") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text)))))) |
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
OrgDoc | |
|
Instances
Eq OrgDoc Source # | |
Show OrgDoc Source # | |
Generic OrgDoc Source # | |
Hashable OrgDoc Source # | |
type Rep OrgDoc Source # | |
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]))) |
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 # | |
Show Section Source # | |
Generic Section Source # | |
Hashable Section Source # | |
type Rep Section Source # | |
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))) |
Some logically distinct block of Org content.
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.
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 -
characters.
- Feed the cat - The good stuff - Feed the dog - He'll eat anything - Feed the bird - Feed the alligator - Feed the elephant
A line in a bullet-list. Can contain sublists, as shown in ListItems
.
Instances
Eq Item Source # | |
Show Item Source # | |
Generic Item Source # | |
Hashable Item Source # | |
type Rep Item Source # | |
Defined in Data.Org type Rep Item = D1 (MetaData "Item" "Data.Org" "org-mode-1.0.1-94JShmsJNw9678GWopnE9B" 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
Eq Row Source # | |
Show Row Source # | |
Generic Row Source # | |
Hashable Row Source # | |
type Rep Row Source # | |
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)))) |
A possibly empty column in an org table.
Instances
Eq Column Source # | |
Show Column Source # | |
Generic Column Source # | |
Hashable Column Source # | |
type Rep Column Source # | |
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)))) |
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.
Pretty Printing
prettyOrgFile :: OrgFile -> Text Source #
prettyWords :: Words -> Text Source #