| Copyright | (c) Colin Woodbury 2020 |
|---|---|
| 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
- data Section = Section {
- sectionHeading :: NonEmpty Words
- sectionTags :: [Text]
- sectionDoc :: OrgDoc
- 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 (Map Text Text)
- 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.
Constructors
| OrgFile | |
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.1.1-34DePfpMiI0KllCJ2EO5yR" '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
| 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.1.1-34DePfpMiI0KllCJ2EO5yR" '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~.
Constructors
| Section | |
Fields
| |
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.1.1-34DePfpMiI0KllCJ2EO5yR" 'False) (C1 ('MetaCons "Section" 'PrefixI 'True) (S1 ('MetaSel ('Just "sectionHeading") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty Words)) :*: (S1 ('MetaSel ('Just "sectionTags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text]) :*: S1 ('MetaSel ('Just "sectionDoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 OrgDoc)))) | |
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 | |
| Tags (NonEmpty Text) | |
| 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.1.1-34DePfpMiI0KllCJ2EO5yR" '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.1.1-34DePfpMiI0KllCJ2EO5yR" '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.1.1-34DePfpMiI0KllCJ2EO5yR" '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 #