-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Types for representing a structured document
--   
--   <tt>Text.Pandoc.Definition</tt> defines the <a>Pandoc</a> data
--   structure, which is used by pandoc to represent structured documents.
--   This module used to live in the pandoc package, but starting with
--   pandoc 1.7, it has been split off, so that other packages can use it
--   without drawing in all of pandoc's dependencies, and pandoc itself can
--   depend on packages (like citeproc-hs) that use them.
--   
--   <tt>Text.Pandoc.Builder</tt> provides functions for building up
--   <tt>Pandoc</tt> structures programmatically.
--   
--   <tt>Text.Pandoc.Generic</tt> provides generic functions for
--   manipulating Pandoc documents.
--   
--   <tt>Text.Pandoc.Walk</tt> provides faster, nongeneric functions for
--   manipulating Pandoc documents.
--   
--   <tt>Text.Pandoc.JSON</tt> provides functions for serializing and
--   deserializing a <tt>Pandoc</tt> structure to and from JSON.
@package pandoc-types
@version 1.16.1


-- | Generic functions for manipulating <tt>Pandoc</tt> documents. (Note:
--   the functions defined in <tt>Text.Pandoc.Walk</tt> should be used
--   instead, when possible, as they are much faster.)
--   
--   Here's a simple example, defining a function that replaces all the
--   level 3+ headers in a document with regular paragraphs in ALL CAPS:
--   
--   <pre>
--   import Text.Pandoc.Definition
--   import Text.Pandoc.Generic
--   import Data.Char (toUpper)
--   
--   modHeader :: Block -&gt; Block
--   modHeader (Header n _ xs) | n &gt;= 3 = Para $ bottomUp allCaps xs
--   modHeader x = x
--   
--   allCaps :: Inline -&gt; Inline
--   allCaps (Str xs) = Str $ map toUpper xs
--   allCaps x = x
--   
--   changeHeaders :: Pandoc -&gt; Pandoc
--   changeHeaders = bottomUp modHeader
--   </pre>
--   
--   <a>bottomUp</a> is so called because it traverses the <tt>Pandoc</tt>
--   structure from bottom up. <a>topDown</a> goes the other way. The
--   difference between them can be seen from this example:
--   
--   <pre>
--   normal :: [Inline] -&gt; [Inline]
--   normal (Space : Space : xs) = Space : xs
--   normal (Emph xs : Emph ys : zs) = Emph (xs ++ ys) : zs
--   normal xs = xs
--   
--   myDoc :: Pandoc
--   myDoc =  Pandoc nullMeta
--    [ Para [Str "Hi",Space,Emph [Str "world",Space],Emph [Space,Str "emphasized"]]]
--   </pre>
--   
--   Here we want to use <a>topDown</a> to lift <tt>normal</tt> to
--   <tt>Pandoc -&gt; Pandoc</tt>. The top down strategy will collapse the
--   two adjacent <tt>Emph</tt>s first, then collapse the resulting
--   adjacent <tt>Space</tt>s, as desired. If we used <a>bottomUp</a>, we
--   would end up with two adjacent <tt>Space</tt>s, since the contents of
--   the two <tt>Emph</tt> inlines would be processed before the
--   <tt>Emph</tt>s were collapsed into one.
--   
--   <pre>
--   topDown normal myDoc ==
--     Pandoc nullMeta
--      [Para [Str "Hi",Space,Emph [Str "world",Space,Str "emphasized"]]]
--   
--   bottomUp normal myDoc ==
--     Pandoc nullMeta
--      [Para [Str "Hi",Space,Emph [Str "world",Space,Space,Str "emphasized"]]]
--   </pre>
--   
--   <a>bottomUpM</a> is a monadic version of <a>bottomUp</a>. It could be
--   used, for example, to replace the contents of delimited code blocks
--   with attribute <tt>include=FILENAME</tt> with the contents of
--   <tt>FILENAME</tt>:
--   
--   <pre>
--   doInclude :: Block -&gt; IO Block
--   doInclude cb@(CodeBlock (id, classes, namevals) contents) =
--     case lookup "include" namevals of
--          Just f  -&gt; return . (CodeBlock (id, classes, namevals)) =&lt;&lt; readFile f
--          Nothing -&gt; return cb
--   doInclude x = return x
--   
--   processIncludes :: Pandoc -&gt; IO Pandoc
--   processIncludes = bottomUpM doInclude
--   </pre>
--   
--   <a>queryWith</a> can be used, for example, to compile a list of URLs
--   linked to in a document:
--   
--   <pre>
--   extractURL :: Inline -&gt; [String]
--   extractURL (Link _ (u,_)) = [u]
--   extractURL (Image _ _ (u,_)) = [u]
--   extractURL _ = []
--   
--   extractURLs :: Pandoc -&gt; [String]
--   extractURLs = queryWith extractURL
--   </pre>
module Text.Pandoc.Generic

-- | Applies a transformation on <tt>a</tt>s to matching elements in a
--   <tt>b</tt>, moving from the bottom of the structure up.
bottomUp :: (Data a, Data b) => (a -> a) -> b -> b

-- | Applies a transformation on <tt>a</tt>s to matching elements in a
--   <tt>b</tt>, moving from the top of the structure down.
topDown :: (Data a, Data b) => (a -> a) -> b -> b

-- | Like <a>bottomUp</a>, but with monadic transformations.
bottomUpM :: (Monad m, Data a, Data b) => (a -> m a) -> b -> m b

-- | Runs a query on matching <tt>a</tt> elements in a <tt>c</tt>. The
--   results of the queries are combined using <a>mappend</a>.
queryWith :: (Data a, Monoid b, Data c) => (a -> b) -> c -> b


-- | Definition of <a>Pandoc</a> data structure for format-neutral
--   representation of documents.
module Text.Pandoc.Definition
data Pandoc
Pandoc :: Meta -> [Block] -> Pandoc

-- | Metadata for the document: title, authors, date.
newtype Meta
Meta :: Map String MetaValue -> Meta
[unMeta] :: Meta -> Map String MetaValue
data MetaValue
MetaMap :: (Map String MetaValue) -> MetaValue
MetaList :: [MetaValue] -> MetaValue
MetaBool :: Bool -> MetaValue
MetaString :: String -> MetaValue
MetaInlines :: [Inline] -> MetaValue
MetaBlocks :: [Block] -> MetaValue
nullMeta :: Meta
isNullMeta :: Meta -> Bool

-- | Retrieve the metadata value for a given <tt>key</tt>.
lookupMeta :: String -> Meta -> Maybe MetaValue

-- | Extract document title from metadata; works just like the old
--   <tt>docTitle</tt>.
docTitle :: Meta -> [Inline]

-- | Extract document authors from metadata; works just like the old
--   <tt>docAuthors</tt>.
docAuthors :: Meta -> [[Inline]]

-- | Extract date from metadata; works just like the old <tt>docDate</tt>.
docDate :: Meta -> [Inline]

-- | Block element.
data Block

-- | Plain text, not a paragraph
Plain :: [Inline] -> Block

-- | Paragraph
Para :: [Inline] -> Block

-- | Code block (literal) with attributes
CodeBlock :: Attr -> String -> Block

-- | Raw block
RawBlock :: Format -> String -> Block

-- | Block quote (list of blocks)
BlockQuote :: [Block] -> Block

-- | Ordered list (attributes and a list of items, each a list of blocks)
OrderedList :: ListAttributes -> [[Block]] -> Block

-- | Bullet list (list of items, each a list of blocks)
BulletList :: [[Block]] -> 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)
DefinitionList :: [([Inline], [[Block]])] -> Block

-- | Header - level (integer) and text (inlines)
Header :: Int -> Attr -> [Inline] -> Block

-- | Horizontal rule
HorizontalRule :: Block

-- | 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)
Table :: [Inline] -> [Alignment] -> [Double] -> [TableCell] -> [[TableCell]] -> Block

-- | Generic block container with attributes
Div :: Attr -> [Block] -> Block

-- | Nothing
Null :: Block

-- | Inline elements.
data Inline

-- | Text (string)
Str :: String -> Inline

-- | Emphasized text (list of inlines)
Emph :: [Inline] -> Inline

-- | Strongly emphasized text (list of inlines)
Strong :: [Inline] -> Inline

-- | Strikeout text (list of inlines)
Strikeout :: [Inline] -> Inline

-- | Superscripted text (list of inlines)
Superscript :: [Inline] -> Inline

-- | Subscripted text (list of inlines)
Subscript :: [Inline] -> Inline

-- | Small caps text (list of inlines)
SmallCaps :: [Inline] -> Inline

-- | Quoted text (list of inlines)
Quoted :: QuoteType -> [Inline] -> Inline

-- | Citation (list of inlines)
Cite :: [Citation] -> [Inline] -> Inline

-- | Inline code (literal)
Code :: Attr -> String -> Inline

-- | Inter-word space
Space :: Inline

-- | Soft line break
SoftBreak :: Inline

-- | Hard line break
LineBreak :: Inline

-- | TeX math (literal)
Math :: MathType -> String -> Inline

-- | Raw inline
RawInline :: Format -> String -> Inline

-- | Hyperlink: alt text (list of inlines), target
Link :: Attr -> [Inline] -> Target -> Inline

-- | Image: alt text (list of inlines), target
Image :: Attr -> [Inline] -> Target -> Inline

-- | Footnote or endnote
Note :: [Block] -> Inline

-- | Generic inline container with attributes
Span :: Attr -> [Inline] -> Inline

-- | Alignment of a table column.
data Alignment
AlignLeft :: Alignment
AlignRight :: Alignment
AlignCenter :: Alignment
AlignDefault :: Alignment

-- | List attributes.
type ListAttributes = (Int, ListNumberStyle, ListNumberDelim)

-- | Style of list numbers.
data ListNumberStyle
DefaultStyle :: ListNumberStyle
Example :: ListNumberStyle
Decimal :: ListNumberStyle
LowerRoman :: ListNumberStyle
UpperRoman :: ListNumberStyle
LowerAlpha :: ListNumberStyle
UpperAlpha :: ListNumberStyle

-- | Delimiter of list numbers.
data ListNumberDelim
DefaultDelim :: ListNumberDelim
Period :: ListNumberDelim
OneParen :: ListNumberDelim
TwoParens :: ListNumberDelim

-- | Formats for raw blocks
newtype Format
Format :: String -> Format

-- | Attributes: identifier, classes, key-value pairs
type Attr = (String, [String], [(String, String)])
nullAttr :: Attr

-- | Table cells are list of Blocks
type TableCell = [Block]

-- | Type of quotation marks to use in Quoted inline.
data QuoteType
SingleQuote :: QuoteType
DoubleQuote :: QuoteType

-- | Link target (URL, title).
type Target = (String, String)

-- | Type of math element (display or inline).
data MathType
DisplayMath :: MathType
InlineMath :: MathType
data Citation
Citation :: String -> [Inline] -> [Inline] -> CitationMode -> Int -> Int -> Citation
[citationId] :: Citation -> String
[citationPrefix] :: Citation -> [Inline]
[citationSuffix] :: Citation -> [Inline]
[citationMode] :: Citation -> CitationMode
[citationNoteNum] :: Citation -> Int
[citationHash] :: Citation -> Int
data CitationMode
AuthorInText :: CitationMode
SuppressAuthor :: CitationMode
NormalCitation :: CitationMode
pandocTypesVersion :: Version
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_0Pandoc
instance GHC.Generics.Datatype Text.Pandoc.Definition.D1Pandoc
instance GHC.Generics.Selector Text.Pandoc.Definition.S1_0_0Meta
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_0Meta
instance GHC.Generics.Datatype Text.Pandoc.Definition.D1Meta
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_5MetaValue
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_4MetaValue
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_3MetaValue
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_2MetaValue
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_1MetaValue
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_0MetaValue
instance GHC.Generics.Datatype Text.Pandoc.Definition.D1MetaValue
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_12Block
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_11Block
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_10Block
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_9Block
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_8Block
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_7Block
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_6Block
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_5Block
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_4Block
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_3Block
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_2Block
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_1Block
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_0Block
instance GHC.Generics.Datatype Text.Pandoc.Definition.D1Block
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_18Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_17Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_16Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_15Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_14Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_13Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_12Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_11Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_10Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_9Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_8Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_7Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_6Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_5Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_4Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_3Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_2Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_1Inline
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_0Inline
instance GHC.Generics.Datatype Text.Pandoc.Definition.D1Inline
instance GHC.Generics.Selector Text.Pandoc.Definition.S1_0_5Citation
instance GHC.Generics.Selector Text.Pandoc.Definition.S1_0_4Citation
instance GHC.Generics.Selector Text.Pandoc.Definition.S1_0_3Citation
instance GHC.Generics.Selector Text.Pandoc.Definition.S1_0_2Citation
instance GHC.Generics.Selector Text.Pandoc.Definition.S1_0_1Citation
instance GHC.Generics.Selector Text.Pandoc.Definition.S1_0_0Citation
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_0Citation
instance GHC.Generics.Datatype Text.Pandoc.Definition.D1Citation
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_2CitationMode
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_1CitationMode
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_0CitationMode
instance GHC.Generics.Datatype Text.Pandoc.Definition.D1CitationMode
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_1MathType
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_0MathType
instance GHC.Generics.Datatype Text.Pandoc.Definition.D1MathType
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_1QuoteType
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_0QuoteType
instance GHC.Generics.Datatype Text.Pandoc.Definition.D1QuoteType
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_0Format
instance GHC.Generics.Datatype Text.Pandoc.Definition.D1Format
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_3ListNumberDelim
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_2ListNumberDelim
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_1ListNumberDelim
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_0ListNumberDelim
instance GHC.Generics.Datatype Text.Pandoc.Definition.D1ListNumberDelim
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_6ListNumberStyle
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_5ListNumberStyle
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_4ListNumberStyle
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_3ListNumberStyle
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_2ListNumberStyle
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_1ListNumberStyle
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_0ListNumberStyle
instance GHC.Generics.Datatype Text.Pandoc.Definition.D1ListNumberStyle
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_3Alignment
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_2Alignment
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_1Alignment
instance GHC.Generics.Constructor Text.Pandoc.Definition.C1_0Alignment
instance GHC.Generics.Datatype Text.Pandoc.Definition.D1Alignment
instance GHC.Generics.Generic Text.Pandoc.Definition.Pandoc
instance Data.Data.Data Text.Pandoc.Definition.Pandoc
instance GHC.Show.Show Text.Pandoc.Definition.Pandoc
instance GHC.Read.Read Text.Pandoc.Definition.Pandoc
instance GHC.Classes.Ord Text.Pandoc.Definition.Pandoc
instance GHC.Classes.Eq Text.Pandoc.Definition.Pandoc
instance GHC.Generics.Generic Text.Pandoc.Definition.Meta
instance Data.Data.Data Text.Pandoc.Definition.Meta
instance GHC.Read.Read Text.Pandoc.Definition.Meta
instance GHC.Show.Show Text.Pandoc.Definition.Meta
instance GHC.Classes.Ord Text.Pandoc.Definition.Meta
instance GHC.Classes.Eq Text.Pandoc.Definition.Meta
instance GHC.Generics.Generic Text.Pandoc.Definition.MetaValue
instance Data.Data.Data Text.Pandoc.Definition.MetaValue
instance GHC.Read.Read Text.Pandoc.Definition.MetaValue
instance GHC.Show.Show Text.Pandoc.Definition.MetaValue
instance GHC.Classes.Ord Text.Pandoc.Definition.MetaValue
instance GHC.Classes.Eq Text.Pandoc.Definition.MetaValue
instance GHC.Generics.Generic Text.Pandoc.Definition.Block
instance Data.Data.Data Text.Pandoc.Definition.Block
instance GHC.Show.Show Text.Pandoc.Definition.Block
instance GHC.Read.Read Text.Pandoc.Definition.Block
instance GHC.Classes.Ord Text.Pandoc.Definition.Block
instance GHC.Classes.Eq Text.Pandoc.Definition.Block
instance GHC.Generics.Generic Text.Pandoc.Definition.Inline
instance Data.Data.Data Text.Pandoc.Definition.Inline
instance GHC.Read.Read Text.Pandoc.Definition.Inline
instance GHC.Classes.Ord Text.Pandoc.Definition.Inline
instance GHC.Classes.Eq Text.Pandoc.Definition.Inline
instance GHC.Show.Show Text.Pandoc.Definition.Inline
instance GHC.Generics.Generic Text.Pandoc.Definition.Citation
instance Data.Data.Data Text.Pandoc.Definition.Citation
instance GHC.Read.Read Text.Pandoc.Definition.Citation
instance GHC.Classes.Eq Text.Pandoc.Definition.Citation
instance GHC.Show.Show Text.Pandoc.Definition.Citation
instance GHC.Generics.Generic Text.Pandoc.Definition.CitationMode
instance Data.Data.Data Text.Pandoc.Definition.CitationMode
instance GHC.Read.Read Text.Pandoc.Definition.CitationMode
instance GHC.Classes.Ord Text.Pandoc.Definition.CitationMode
instance GHC.Classes.Eq Text.Pandoc.Definition.CitationMode
instance GHC.Show.Show Text.Pandoc.Definition.CitationMode
instance GHC.Generics.Generic Text.Pandoc.Definition.MathType
instance Data.Data.Data Text.Pandoc.Definition.MathType
instance GHC.Read.Read Text.Pandoc.Definition.MathType
instance GHC.Classes.Ord Text.Pandoc.Definition.MathType
instance GHC.Classes.Eq Text.Pandoc.Definition.MathType
instance GHC.Show.Show Text.Pandoc.Definition.MathType
instance GHC.Generics.Generic Text.Pandoc.Definition.QuoteType
instance Data.Data.Data Text.Pandoc.Definition.QuoteType
instance GHC.Read.Read Text.Pandoc.Definition.QuoteType
instance GHC.Classes.Ord Text.Pandoc.Definition.QuoteType
instance GHC.Classes.Eq Text.Pandoc.Definition.QuoteType
instance GHC.Show.Show Text.Pandoc.Definition.QuoteType
instance GHC.Generics.Generic Text.Pandoc.Definition.Format
instance Data.Data.Data Text.Pandoc.Definition.Format
instance GHC.Show.Show Text.Pandoc.Definition.Format
instance GHC.Read.Read Text.Pandoc.Definition.Format
instance GHC.Generics.Generic Text.Pandoc.Definition.ListNumberDelim
instance Data.Data.Data Text.Pandoc.Definition.ListNumberDelim
instance GHC.Read.Read Text.Pandoc.Definition.ListNumberDelim
instance GHC.Show.Show Text.Pandoc.Definition.ListNumberDelim
instance GHC.Classes.Ord Text.Pandoc.Definition.ListNumberDelim
instance GHC.Classes.Eq Text.Pandoc.Definition.ListNumberDelim
instance GHC.Generics.Generic Text.Pandoc.Definition.ListNumberStyle
instance Data.Data.Data Text.Pandoc.Definition.ListNumberStyle
instance GHC.Read.Read Text.Pandoc.Definition.ListNumberStyle
instance GHC.Show.Show Text.Pandoc.Definition.ListNumberStyle
instance GHC.Classes.Ord Text.Pandoc.Definition.ListNumberStyle
instance GHC.Classes.Eq Text.Pandoc.Definition.ListNumberStyle
instance GHC.Generics.Generic Text.Pandoc.Definition.Alignment
instance Data.Data.Data Text.Pandoc.Definition.Alignment
instance GHC.Read.Read Text.Pandoc.Definition.Alignment
instance GHC.Show.Show Text.Pandoc.Definition.Alignment
instance GHC.Classes.Ord Text.Pandoc.Definition.Alignment
instance GHC.Classes.Eq Text.Pandoc.Definition.Alignment
instance GHC.Base.Monoid Text.Pandoc.Definition.Pandoc
instance GHC.Base.Monoid Text.Pandoc.Definition.Meta
instance Data.String.IsString Text.Pandoc.Definition.Format
instance GHC.Classes.Eq Text.Pandoc.Definition.Format
instance GHC.Classes.Ord Text.Pandoc.Definition.Format
instance GHC.Classes.Ord Text.Pandoc.Definition.Citation
instance Data.Aeson.Types.Class.FromJSON Text.Pandoc.Definition.MetaValue
instance Data.Aeson.Types.Class.ToJSON Text.Pandoc.Definition.MetaValue
instance Data.Aeson.Types.Class.FromJSON Text.Pandoc.Definition.Meta
instance Data.Aeson.Types.Class.ToJSON Text.Pandoc.Definition.Meta
instance Data.Aeson.Types.Class.FromJSON Text.Pandoc.Definition.CitationMode
instance Data.Aeson.Types.Class.ToJSON Text.Pandoc.Definition.CitationMode
instance Data.Aeson.Types.Class.FromJSON Text.Pandoc.Definition.Citation
instance Data.Aeson.Types.Class.ToJSON Text.Pandoc.Definition.Citation
instance Data.Aeson.Types.Class.FromJSON Text.Pandoc.Definition.QuoteType
instance Data.Aeson.Types.Class.ToJSON Text.Pandoc.Definition.QuoteType
instance Data.Aeson.Types.Class.FromJSON Text.Pandoc.Definition.MathType
instance Data.Aeson.Types.Class.ToJSON Text.Pandoc.Definition.MathType
instance Data.Aeson.Types.Class.FromJSON Text.Pandoc.Definition.ListNumberStyle
instance Data.Aeson.Types.Class.ToJSON Text.Pandoc.Definition.ListNumberStyle
instance Data.Aeson.Types.Class.FromJSON Text.Pandoc.Definition.ListNumberDelim
instance Data.Aeson.Types.Class.ToJSON Text.Pandoc.Definition.ListNumberDelim
instance Data.Aeson.Types.Class.FromJSON Text.Pandoc.Definition.Alignment
instance Data.Aeson.Types.Class.ToJSON Text.Pandoc.Definition.Alignment
instance Data.Aeson.Types.Class.FromJSON Text.Pandoc.Definition.Format
instance Data.Aeson.Types.Class.ToJSON Text.Pandoc.Definition.Format
instance Data.Aeson.Types.Class.FromJSON Text.Pandoc.Definition.Inline
instance Data.Aeson.Types.Class.ToJSON Text.Pandoc.Definition.Inline
instance Data.Aeson.Types.Class.FromJSON Text.Pandoc.Definition.Block
instance Data.Aeson.Types.Class.ToJSON Text.Pandoc.Definition.Block
instance Data.Aeson.Types.Class.FromJSON Text.Pandoc.Definition.Pandoc
instance Data.Aeson.Types.Class.ToJSON Text.Pandoc.Definition.Pandoc
instance Control.DeepSeq.NFData Text.Pandoc.Definition.MetaValue
instance Control.DeepSeq.NFData Text.Pandoc.Definition.Meta
instance Control.DeepSeq.NFData Text.Pandoc.Definition.Citation
instance Control.DeepSeq.NFData Text.Pandoc.Definition.Alignment
instance Control.DeepSeq.NFData Text.Pandoc.Definition.Inline
instance Control.DeepSeq.NFData Text.Pandoc.Definition.MathType
instance Control.DeepSeq.NFData Text.Pandoc.Definition.Format
instance Control.DeepSeq.NFData Text.Pandoc.Definition.CitationMode
instance Control.DeepSeq.NFData Text.Pandoc.Definition.QuoteType
instance Control.DeepSeq.NFData Text.Pandoc.Definition.ListNumberDelim
instance Control.DeepSeq.NFData Text.Pandoc.Definition.ListNumberStyle
instance Control.DeepSeq.NFData Text.Pandoc.Definition.Block
instance Control.DeepSeq.NFData Text.Pandoc.Definition.Pandoc


-- | Convenience functions for building pandoc documents programmatically.
--   
--   Example of use (with <tt>OverloadedStrings</tt> pragma):
--   
--   <pre>
--   import Text.Pandoc.Builder
--   
--   myDoc :: Pandoc
--   myDoc = setTitle "My title" $ doc $
--     para "This is the first paragraph" &lt;&gt;
--     para ("And " &lt;&gt; emph "another" &lt;&gt; ".") &lt;&gt;
--     bulletList [ para "item one" &lt;&gt; para "continuation"
--                , plain ("item two and a " &lt;&gt;
--                    link "/url" "go to url" "link")
--                ]
--   </pre>
--   
--   Isn't that nicer than writing the following?
--   
--   <pre>
--   import Text.Pandoc.Definition
--   import Data.Map (fromList)
--   
--   myDoc :: Pandoc
--   myDoc = Pandoc (Meta {unMeta = fromList [("title",
--             MetaInlines [Str "My",Space,Str "title"])]})
--           [Para [Str "This",Space,Str "is",Space,Str "the",Space,Str "first",
--            Space,Str "paragraph"],Para [Str "And",Space,Emph [Str "another"],
--            Str "."]
--           ,BulletList [
--             [Para [Str "item",Space,Str "one"]
--             ,Para [Str "continuation"]]
--            ,[Plain [Str "item",Space,Str "two",Space,Str "and",Space,
--                     Str "a",Space,Link nullAttr [Str "link"] ("/url","go to url")]]]]
--   </pre>
--   
--   And of course, you can use Haskell to define your own builders:
--   
--   <pre>
--   import Text.Pandoc.Builder
--   import Text.JSON
--   import Control.Arrow ((***))
--   import Data.Monoid (mempty)
--   
--   -- | Converts a JSON document into 'Blocks'.
--   json :: String -&gt; Blocks
--   json x =
--     case decode x of
--          Ok y    -&gt; jsValueToBlocks y
--          Error y -&gt; error y
--      where jsValueToBlocks x =
--             case x of
--              JSNull         -&gt; mempty
--              JSBool x       -&gt; plain $ text $ show x
--              JSRational _ x -&gt; plain $ text $ show x
--              JSString x     -&gt; plain $ text $ fromJSString x
--              JSArray xs     -&gt; bulletList $ map jsValueToBlocks xs
--              JSObject x     -&gt; definitionList $
--                                 map (text *** (:[]) . jsValueToBlocks) $
--                                 fromJSObject x
--   </pre>
module Text.Pandoc.Builder
newtype Many a
Many :: Seq a -> Many a
[unMany] :: Many a -> Seq a
type Inlines = Many Inline
type Blocks = Many Block

-- | An infix synonym for <a>mappend</a>.
(<>) :: Monoid m => m -> m -> m
singleton :: a -> Many a
toList :: Many a -> [a]
fromList :: [a] -> Many a
isNull :: Many a -> Bool
doc :: Blocks -> Pandoc
class ToMetaValue a
toMetaValue :: ToMetaValue a => a -> MetaValue
class HasMeta a
setMeta :: (HasMeta a, ToMetaValue b) => String -> b -> a -> a
deleteMeta :: HasMeta a => String -> a -> a
setTitle :: Inlines -> Pandoc -> Pandoc
setAuthors :: [Inlines] -> Pandoc -> Pandoc
setDate :: Inlines -> Pandoc -> Pandoc

-- | Convert a <a>String</a> to <a>Inlines</a>, treating interword spaces
--   as <a>Space</a>s or <a>SoftBreak</a>s. If you want a <a>Str</a> with
--   literal spaces, use <a>str</a>.
text :: String -> Inlines
str :: String -> Inlines
emph :: Inlines -> Inlines
strong :: Inlines -> Inlines
strikeout :: Inlines -> Inlines
superscript :: Inlines -> Inlines
subscript :: Inlines -> Inlines
smallcaps :: Inlines -> Inlines
singleQuoted :: Inlines -> Inlines
doubleQuoted :: Inlines -> Inlines
cite :: [Citation] -> Inlines -> Inlines

-- | Inline code with attributes.
codeWith :: Attr -> String -> Inlines

-- | Plain inline code.
code :: String -> Inlines
space :: Inlines
softbreak :: Inlines
linebreak :: Inlines

-- | Inline math
math :: String -> Inlines

-- | Display math
displayMath :: String -> Inlines
rawInline :: String -> String -> Inlines
link :: String -> String -> Inlines -> Inlines
linkWith :: Attr -> String -> String -> Inlines -> Inlines
image :: String -> String -> Inlines -> Inlines
imageWith :: Attr -> String -> String -> Inlines -> Inlines
note :: Blocks -> Inlines
spanWith :: Attr -> Inlines -> Inlines

-- | Trim leading and trailing spaces and softbreaks from an Inlines.
trimInlines :: Inlines -> Inlines
para :: Inlines -> Blocks
plain :: Inlines -> Blocks

-- | A code block with attributes.
codeBlockWith :: Attr -> String -> Blocks

-- | A plain code block.
codeBlock :: String -> Blocks
rawBlock :: String -> String -> Blocks
blockQuote :: Blocks -> Blocks
bulletList :: [Blocks] -> Blocks

-- | Ordered list with attributes.
orderedListWith :: ListAttributes -> [Blocks] -> Blocks

-- | Ordered list with default attributes.
orderedList :: [Blocks] -> Blocks
definitionList :: [(Inlines, [Blocks])] -> Blocks
header :: Int -> Inlines -> Blocks
headerWith :: Attr -> Int -> Inlines -> Blocks
horizontalRule :: Blocks
table :: Inlines -> [(Alignment, Double)] -> [Blocks] -> [[Blocks]] -> Blocks

-- | A simple table without a caption.
simpleTable :: [Blocks] -> [[Blocks]] -> Blocks
divWith :: Attr -> Blocks -> Blocks
instance GHC.Generics.Selector Text.Pandoc.Builder.S1_0_0Many
instance GHC.Generics.Constructor Text.Pandoc.Builder.C1_0Many
instance GHC.Generics.Datatype Text.Pandoc.Builder.D1Many
instance GHC.Read.Read a => GHC.Read.Read (Text.Pandoc.Builder.Many a)
instance GHC.Show.Show a => GHC.Show.Show (Text.Pandoc.Builder.Many a)
instance GHC.Base.Functor Text.Pandoc.Builder.Many
instance Data.Traversable.Traversable Text.Pandoc.Builder.Many
instance Data.Foldable.Foldable Text.Pandoc.Builder.Many
instance GHC.Classes.Eq a => GHC.Classes.Eq (Text.Pandoc.Builder.Many a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Text.Pandoc.Builder.Many a)
instance Data.Data.Data a => Data.Data.Data (Text.Pandoc.Builder.Many a)
instance GHC.Generics.Generic (Text.Pandoc.Builder.Many a)
instance GHC.Base.Monoid (Text.Pandoc.Builder.Many Text.Pandoc.Definition.Block)
instance GHC.Base.Monoid Text.Pandoc.Builder.Inlines
instance Data.String.IsString Text.Pandoc.Builder.Inlines
instance Text.Pandoc.Builder.ToMetaValue Text.Pandoc.Definition.MetaValue
instance Text.Pandoc.Builder.ToMetaValue Text.Pandoc.Builder.Blocks
instance Text.Pandoc.Builder.ToMetaValue Text.Pandoc.Builder.Inlines
instance Text.Pandoc.Builder.ToMetaValue GHC.Types.Bool
instance Text.Pandoc.Builder.ToMetaValue a => Text.Pandoc.Builder.ToMetaValue [a]
instance Text.Pandoc.Builder.ToMetaValue a => Text.Pandoc.Builder.ToMetaValue (Data.Map.Base.Map GHC.Base.String a)
instance Text.Pandoc.Builder.HasMeta Text.Pandoc.Definition.Meta
instance Text.Pandoc.Builder.HasMeta Text.Pandoc.Definition.Pandoc


-- | Functions for manipulating <a>Pandoc</a> documents or extracting
--   information from them by walking the <a>Pandoc</a> structure (or
--   intermediate structures like '[Block]' or '[Inline]'. These are faster
--   (by a factor of four or five) than the generic functions defined in
--   <tt>Text.Pandoc.Generic</tt>.
--   
--   Here's a simple example, defining a function that replaces all the
--   level 3+ headers in a document with regular paragraphs in ALL CAPS:
--   
--   <pre>
--   import Text.Pandoc.Definition
--   import Text.Pandoc.Walk
--   import Data.Char (toUpper)
--   
--   modHeader :: Block -&gt; Block
--   modHeader (Header n _ xs) | n &gt;= 3 = Para $ walk allCaps xs
--   modHeader x = x
--   
--   allCaps :: Inline -&gt; Inline
--   allCaps (Str xs) = Str $ map toUpper xs
--   allCaps x = x
--   
--   changeHeaders :: Pandoc -&gt; Pandoc
--   changeHeaders = walk modHeader
--   </pre>
--   
--   <a>query</a> can be used, for example, to compile a list of URLs
--   linked to in a document:
--   
--   <pre>
--   extractURL :: Inline -&gt; [String]
--   extractURL (Link _ _ (u,_)) = [u]
--   extractURL (Image _ _ (u,_)) = [u]
--   extractURL _ = []
--   
--   extractURLs :: Pandoc -&gt; [String]
--   extractURLs = query extractURL
--   </pre>
module Text.Pandoc.Walk
class Walkable a b

-- | <tt>walk f x</tt> walks the structure <tt>x</tt> (bottom up) and
--   replaces every occurrence of an <tt>a</tt> with the result of applying
--   <tt>f</tt> to it.
walk :: Walkable a b => (a -> a) -> b -> b

-- | A monadic version of <a>walk</a>.
walkM :: (Walkable a b, Monad m, Functor m) => (a -> m a) -> b -> m b

-- | <tt>query f x</tt> walks the structure <tt>x</tt> (bottom up) and
--   applies <tt>f</tt> to every <tt>a</tt>, appending the results.
query :: (Walkable a b, Monoid c) => (a -> c) -> b -> c
instance (Data.Foldable.Foldable t, Data.Traversable.Traversable t, Text.Pandoc.Walk.Walkable a b) => Text.Pandoc.Walk.Walkable a (t b)
instance (Text.Pandoc.Walk.Walkable a b, Text.Pandoc.Walk.Walkable a c) => Text.Pandoc.Walk.Walkable a (b, c)
instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Inline Text.Pandoc.Definition.Inline
instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Inline Text.Pandoc.Definition.Block
instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Block Text.Pandoc.Definition.Block
instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Block Text.Pandoc.Definition.Inline
instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Block Text.Pandoc.Definition.Pandoc
instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Inline Text.Pandoc.Definition.Pandoc
instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Pandoc Text.Pandoc.Definition.Pandoc
instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Meta Text.Pandoc.Definition.Meta
instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Inline Text.Pandoc.Definition.Meta
instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Block Text.Pandoc.Definition.Meta
instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Inline Text.Pandoc.Definition.MetaValue
instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Block Text.Pandoc.Definition.MetaValue
instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Inline Text.Pandoc.Definition.Citation
instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Block Text.Pandoc.Definition.Citation


-- | Functions for serializing the Pandoc AST to JSON and deserializing
--   from JSON.
--   
--   Example of use: The following script (<tt>capitalize.hs</tt>) reads
--   reads a JSON representation of a Pandoc document from stdin, and
--   writes a JSON representation of a Pandoc document to stdout. It
--   changes all regular text in the document to uppercase, without
--   affecting URLs, code, tags, etc. Run the script with
--   
--   <pre>
--   pandoc -t json | runghc capitalize.hs | pandoc -f json
--   </pre>
--   
--   or (making capitalize.hs executable)
--   
--   <pre>
--   pandoc --filter ./capitalize.hs
--   </pre>
--   
--   <pre>
--   #!/usr/bin/env runghc
--   import Text.Pandoc.JSON
--   import Data.Char (toUpper)
--   
--   main :: IO ()
--   main = toJSONFilter capitalizeStrings
--   
--   capitalizeStrings :: Inline -&gt; Inline
--   capitalizeStrings (Str s) = Str $ map toUpper s
--   capitalizeStrings x       = x
--   </pre>
module Text.Pandoc.JSON

-- | <a>toJSONFilter</a> convert a function into a filter that reads
--   pandoc's JSON serialized output from stdin, transforms it by walking
--   the AST and applying the specified function, and serializes the result
--   as JSON to stdout.
--   
--   For a straight transformation, use a function of type <tt>a -&gt;
--   a</tt> or <tt>a -&gt; IO a</tt> where <tt>a</tt> = <a>Block</a>,
--   <a>Inline</a>,<a>Pandoc</a>, <a>Meta</a>, or <a>MetaValue</a>.
--   
--   If your transformation needs to be sensitive to the script's
--   arguments, use a function of type <tt>[String] -&gt; a -&gt; a</tt>
--   (with <tt>a</tt> constrained as above). The <tt>[String]</tt> will be
--   populated with the script's arguments.
--   
--   An alternative is to use the type <tt>Maybe Format -&gt; a -&gt;
--   a</tt>. This is appropriate when the first argument of the script (if
--   present) will be the target format, and allows scripts to behave
--   differently depending on the target format. The pandoc executable
--   automatically provides the target format as argument when scripts are
--   called using the `--filter` option.
class ToJSONFilter a
toJSONFilter :: ToJSONFilter a => a -> IO ()
instance Text.Pandoc.Walk.Walkable a Text.Pandoc.Definition.Pandoc => Text.Pandoc.JSON.ToJSONFilter (a -> a)
instance Text.Pandoc.Walk.Walkable a Text.Pandoc.Definition.Pandoc => Text.Pandoc.JSON.ToJSONFilter (a -> GHC.Types.IO a)
instance Data.Data.Data a => Text.Pandoc.JSON.ToJSONFilter (a -> [a])
instance Data.Data.Data a => Text.Pandoc.JSON.ToJSONFilter (a -> GHC.Types.IO [a])
instance Text.Pandoc.JSON.ToJSONFilter a => Text.Pandoc.JSON.ToJSONFilter ([GHC.Base.String] -> a)
instance Text.Pandoc.JSON.ToJSONFilter a => Text.Pandoc.JSON.ToJSONFilter (GHC.Base.Maybe Text.Pandoc.Definition.Format -> a)
