pandoc-types-1.12.4.7: Types for representing a structured document

Copyright | Copyright (C) 2006-2010 John MacFarlane
License | GNU GPL, version 2 or above
Maintainer | John MacFarlane <jgm@berkeley.edu>
Stability | alpha
Portability | portable
Safe Haskell | None
Language | Haskell98

Text.Pandoc.Definition

Description

Definition of `Pandoc` data structure for format-neutral representation of documents.

Synopsis

- data Pandoc = Pandoc Meta [Block]
- newtype Meta = Meta {
  - unMeta :: Map String MetaValue
  }
- data MetaValue
  - = MetaMap (Map String MetaValue)
  - | MetaList [MetaValue]
  - | MetaBool Bool
  - | MetaString String
  - | MetaInlines [Inline]
  - | MetaBlocks [Block]
- nullMeta :: Meta
- isNullMeta :: Meta -> Bool
- lookupMeta :: String -> Meta -> Maybe MetaValue
- docTitle :: Meta -> [Inline]
- docAuthors :: Meta -> [[Inline]]
- docDate :: Meta -> [Inline]
- data Block
  - = Plain [Inline]
  - | Para [Inline]
  - | CodeBlock Attr String
  - | RawBlock Format String
  - | BlockQuote [Block]
  - | OrderedList ListAttributes [[Block]]
  - | BulletList [[Block]]
  - | DefinitionList [([Inline], [[Block]])]
  - | Header Int Attr [Inline]
  - | HorizontalRule
  - | Table [Inline] [Alignment] [Double] [TableCell] [[TableCell]]
  - | Div Attr [Block]
  - | Null
- data Inline
  - = Str String
  - | Emph [Inline]
  - | Strong [Inline]
  - | Strikeout [Inline]
  - | Superscript [Inline]
  - | Subscript [Inline]
  - | SmallCaps [Inline]
  - | Quoted QuoteType [Inline]
  - | Cite [Citation] [Inline]
  - | Code Attr String
  - | Space
  - | LineBreak
  - | Math MathType String
  - | RawInline Format String
  - | Link [Inline] Target
  - | Image [Inline] Target
  - | Note [Block]
  - | Span Attr [Inline]
- data Alignment
  - = AlignLeft
  - | AlignRight
  - | AlignCenter
  - | AlignDefault
- type ListAttributes = (Int, ListNumberStyle, ListNumberDelim)
- data ListNumberStyle
  - = DefaultStyle
  - | Example
  - | Decimal
  - | LowerRoman
  - | UpperRoman
  - | LowerAlpha
  - | UpperAlpha
- data ListNumberDelim
  - = DefaultDelim
  - | Period
  - | OneParen
  - | TwoParens
- newtype Format = Format String
- type Attr = (String, [String], [(String, String)])
- nullAttr :: Attr
- type TableCell = [Block]
- data QuoteType
  - = SingleQuote
  - | DoubleQuote
- type Target = (String, String)
- data MathType
  - = DisplayMath
  - | InlineMath
- data Citation = Citation {
  - citationId :: String
  - citationPrefix :: [Inline]
  - citationSuffix :: [Inline]
  - citationMode :: CitationMode
  - citationNoteNum :: Int
  - citationHash :: Int
  }
- data CitationMode
  - = AuthorInText
  - | SuppressAuthor
  - | NormalCitation

# Documentation

data Pandoc

Constructors

Pandoc Meta [Block] |

Instances

Eq Pandoc |
Data Pandoc |
Ord Pandoc |
Read Pandoc |
Show Pandoc |
Generic Pandoc |
ToJSON Pandoc |
FromJSON Pandoc |
Monoid Pandoc |
NFData Pandoc |
HasMeta Pandoc |
Walkable Inline Pandoc |
Walkable Block Pandoc |
Walkable Pandoc Pandoc |
type Rep Pandoc |

newtype Meta

Metadata for the document: title, authors, date.

Constructors

Meta |
Fields unMeta :: Map String MetaValue

Instances

Eq Meta |
Data Meta |
Ord Meta |
Read Meta |
Show Meta |
Generic Meta |
ToJSON Meta |
FromJSON Meta |
Monoid Meta |
NFData Meta |
HasMeta Meta |
Walkable Inline Meta |
Walkable Block Meta |
Walkable Meta Meta |
type Rep Meta |

data MetaValue

Constructors

MetaMap (Map String MetaValue) |
MetaList [MetaValue] |
MetaBool Bool |
MetaString String |
MetaInlines [Inline] |
MetaBlocks [Block] |

Instances

Eq MetaValue |
Data MetaValue |
Ord MetaValue |
Read MetaValue |
Show MetaValue |
Generic MetaValue |
ToJSON MetaValue |
FromJSON MetaValue |
NFData MetaValue |
ToMetaValue MetaValue |
Walkable Inline MetaValue |
Walkable Block MetaValue |
type Rep MetaValue |

nullMeta :: Meta

isNullMeta :: Meta -> Bool

lookupMeta :: String -> Meta -> Maybe MetaValue

Retrieve the metadata value for a given `key`.

docTitle :: Meta -> [Inline]

Extract document title from metadata; works just like the old `docTitle`.

docAuthors :: Meta -> [[Inline]]

Extract document authors from metadata; works just like the old `docAuthors`.

docDate :: Meta -> [Inline]

Extract date from metadata; works just like the old `docDate`.

data Block

Block element.

Constructors

Plain [Inline] | Plain text, not a paragraph
Para [Inline] | Paragraph
CodeBlock Attr String | Code block (literal) with attributes
RawBlock Format String | Raw block
BlockQuote [Block] | Block quote (list of blocks)
OrderedList ListAttributes [[Block]] | Ordered list (attributes and a list of items, each a list of blocks)
BulletList [[Block]] | Bullet list (list of items, each a list of blocks)
DefinitionList [([Inline], [[Block]])] | Definition list Each list item is a pair consisting of a term (a list of inlines) and one or more definitions (each a list of blocks)
Header Int Attr [Inline] | Header - level (integer) and text (inlines)
HorizontalRule | Horizontal rule
Table [Inline] [Alignment] [Double] [TableCell] [[TableCell]] | Table, with caption, column alignments (required), relative column widths (0 = default), column headers (each a list of blocks), and rows (each a list of lists of blocks)
Div Attr [Block] | Generic block container with attributes
Null | Nothing

Instances

Eq Block |
Data Block |
Ord Block |
Read Block |
Show Block |
Generic Block |
ToJSON Block |
FromJSON Block |
NFData Block |
ToMetaValue Blocks |
Walkable Inline Block |
Walkable Block Citation |
Walkable Block Inline |
Walkable Block Block |
Walkable Block MetaValue |
Walkable Block Meta |
Walkable Block Pandoc |
Monoid (Many Block) |
type Rep Block |

data Inline

Inline elements.

Constructors

Str String | Text (string)
Emph [Inline] | Emphasized text (list of inlines)
Strong [Inline] | Strongly emphasized text (list of inlines)
Strikeout [Inline] | Strikeout text (list of inlines)
Superscript [Inline] | Superscripted text (list of inlines)
Subscript [Inline] | Subscripted text (list of inlines)
SmallCaps [Inline] | Small caps text (list of inlines)
Quoted QuoteType [Inline] | Quoted text (list of inlines)
Cite [Citation] [Inline] | Citation (list of inlines)
Code Attr String | Inline code (literal)
Space | Inter-word space
LineBreak | Hard line break
Math MathType String | TeX math (literal)
RawInline Format String | Raw inline
Link [Inline] Target | Hyperlink: text (list of inlines), target
Image [Inline] Target | Image: alt text (list of inlines), target
Note [Block] | Footnote or endnote
Span Attr [Inline] | Generic inline container with attributes

Instances

Eq Inline |
Data Inline |
Ord Inline |
Read Inline |
Show Inline |
IsString Inlines |
Generic Inline |
ToJSON Inline |
FromJSON Inline |
Monoid Inlines |
NFData Inline |
ToMetaValue Inlines |
Walkable Inline Citation |
Walkable Inline Inline |
Walkable Inline Block |
Walkable Inline MetaValue |
Walkable Inline Meta |
Walkable Inline Pandoc |
Walkable Block Inline |
type Rep Inline |

data Alignment

Alignment of a table column.

Constructors

AlignLeft |
AlignRight |
AlignCenter |
AlignDefault |

Instances

Eq Alignment |
Data Alignment |
Ord Alignment |
Read Alignment |
Show Alignment |
Generic Alignment |
ToJSON Alignment |
FromJSON Alignment |
NFData Alignment |
type Rep Alignment |

type ListAttributes = (Int, ListNumberStyle, ListNumberDelim)

List attributes.

data ListNumberStyle

Style of list numbers.

Constructors

DefaultStyle |
Example |
Decimal |
LowerRoman |
UpperRoman |
LowerAlpha |
UpperAlpha |

Instances

Eq ListNumberStyle |
Data ListNumberStyle |
Ord ListNumberStyle |
Read ListNumberStyle |
Show ListNumberStyle |
Generic ListNumberStyle |
ToJSON ListNumberStyle |
FromJSON ListNumberStyle |
NFData ListNumberStyle |
type Rep ListNumberStyle |

data ListNumberDelim

Delimiter of list numbers.

Constructors

DefaultDelim |
Period |
OneParen |
TwoParens |

Instances

Eq ListNumberDelim |
Data ListNumberDelim |
Ord ListNumberDelim |
Read ListNumberDelim |
Show ListNumberDelim |
Generic ListNumberDelim |
ToJSON ListNumberDelim |
FromJSON ListNumberDelim |
NFData ListNumberDelim |
type Rep ListNumberDelim |

newtype Format

Formats for raw blocks

Constructors

Format String |

Instances

Eq Format |
Data Format |
Ord Format |
Read Format |
Show Format |
IsString Format |
Generic Format |
ToJSON Format |
FromJSON Format |
NFData Format |
ToJSONFilter a => ToJSONFilter (Maybe Format -> a) |
type Rep Format |

type Attr = (String, [String], [(String, String)])

Attributes: identifier, classes, key-value pairs

nullAttr :: Attr

type TableCell = [Block]

Table cells are list of Blocks

data QuoteType

Type of quotation marks to use in Quoted inline.

Constructors

SingleQuote |
DoubleQuote |

Instances

Eq QuoteType |
Data QuoteType |
Ord QuoteType |
Read QuoteType |
Show QuoteType |
Generic QuoteType |
ToJSON QuoteType |
FromJSON QuoteType |
NFData QuoteType |
type Rep QuoteType |

type Target = (String, String)

Link target (URL, title).

data MathType

Type of math element (display or inline).

Constructors

DisplayMath |
InlineMath |

Instances

Eq MathType |
Data MathType |
Ord MathType |
Read MathType |
Show MathType |
Generic MathType |
ToJSON MathType |
FromJSON MathType |
NFData MathType |
type Rep MathType |

data Citation

Constructors

Citation |
Fields citationId :: String citationPrefix :: [Inline] citationSuffix :: [Inline] citationMode :: CitationMode citationNoteNum :: Int citationHash :: Int

Instances

Eq Citation |
Data Citation |
Ord Citation |
Read Citation |
Show Citation |
Generic Citation |
ToJSON Citation |
FromJSON Citation |
NFData Citation |
Walkable Inline Citation |
Walkable Block Citation |
type Rep Citation |

data CitationMode

Constructors

AuthorInText |
SuppressAuthor |
NormalCitation |

Instances

Eq CitationMode |
Data CitationMode |
Ord CitationMode |
Read CitationMode |
Show CitationMode |
Generic CitationMode |
ToJSON CitationMode |
FromJSON CitationMode |
NFData CitationMode |
type Rep CitationMode |