-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Types for representing a structured document -- -- Text.Pandoc.Definition defines the Pandoc 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. -- -- Text.Pandoc.Builder provides functions for building up -- Pandoc structures programmatically. -- -- Text.Pandoc.Generic provides generic functions for -- manipulating Pandoc documents. -- -- Text.Pandoc.Walk provides faster, nongeneric functions for -- manipulating Pandoc documents. -- -- Text.Pandoc.JSON provides functions for serializing and -- deserializing a Pandoc structure to and from JSON. @package pandoc-types @version 1.23.1 -- | Definition of Pandoc 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 Text MetaValue -> Meta [unMeta] :: Meta -> Map Text MetaValue data MetaValue MetaMap :: Map Text MetaValue -> MetaValue MetaList :: [MetaValue] -> MetaValue MetaBool :: Bool -> MetaValue MetaString :: Text -> MetaValue MetaInlines :: [Inline] -> MetaValue MetaBlocks :: [Block] -> MetaValue nullMeta :: Meta isNullMeta :: Meta -> Bool -- | Retrieve the metadata value for a given key. lookupMeta :: Text -> Meta -> Maybe MetaValue -- | Extract document title from metadata; works just like the old -- docTitle. docTitle :: Meta -> [Inline] -- | Extract document authors from metadata; works just like the old -- docAuthors. docAuthors :: Meta -> [[Inline]] -- | Extract date from metadata; works just like the old docDate. docDate :: Meta -> [Inline] -- | Block element. data Block -- | Plain text, not a paragraph Plain :: [Inline] -> Block -- | Paragraph Para :: [Inline] -> Block -- | Multiple non-breaking lines LineBlock :: [[Inline]] -> Block -- | Code block (literal) with attributes CodeBlock :: Attr -> Text -> Block -- | Raw block RawBlock :: Format -> Text -> 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 attributes, caption, optional short caption, column -- alignments and widths (required), table head, table bodies, and table -- foot Table :: Attr -> Caption -> [ColSpec] -> TableHead -> [TableBody] -> TableFoot -> Block -- | Figure, with attributes, caption, and content (list of blocks) Figure :: Attr -> Caption -> [Block] -> Block -- | Generic block container with attributes Div :: Attr -> [Block] -> Block -- | Bidirectional patter synonym -- -- It can pass as a Block constructor -- --
--   >>> SimpleFigure nullAttr [] (T.pack "", T.pack "title")
--   Para [Image ("",[],[]) [] ("","fig:title")]
--   
-- -- It can be used to pattern match >>> let img = Para [Image -- undefined undefined (undefined, T.pack "title")] >>> case img -- of { SimpleFigure _ _ _ -> True; _ -> False } False >>> -- let fig = Para [Image undefined undefined (undefined, T.pack -- "fig:title")] >>> case fig of { SimpleFigure _ _ tit -> -- snd tit; _ -> T.pack "" } "title" pattern SimpleFigure :: Attr -> [Inline] -> Target -> Block -- | Inline elements. data Inline -- | Text (string) Str :: Text -> Inline -- | Emphasized text (list of inlines) Emph :: [Inline] -> Inline -- | Underlined text (list of inlines) Underline :: [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 -> Text -> Inline -- | Inter-word space Space :: Inline -- | Soft line break SoftBreak :: Inline -- | Hard line break LineBreak :: Inline -- | TeX math (literal) Math :: MathType -> Text -> Inline -- | Raw inline RawInline :: Format -> Text -> 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 -- | List attributes. The first element of the triple is the start number -- of the list. 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 :: Text -> Format -- | Attributes: identifier, classes, key-value pairs type Attr = (Text, [Text], [(Text, Text)]) nullAttr :: Attr -- | The caption of a table or figure, with optional short caption. data Caption Caption :: Maybe ShortCaption -> [Block] -> Caption -- | A short caption, for use in, for instance, lists of figures. type ShortCaption = [Inline] -- | The number of columns taken up by the row head of each row of a -- TableBody. The row body takes up the remaining columns. newtype RowHeadColumns RowHeadColumns :: Int -> RowHeadColumns -- | Alignment of a table column. data Alignment AlignLeft :: Alignment AlignRight :: Alignment AlignCenter :: Alignment AlignDefault :: Alignment -- | The width of a table column, as a percentage of the text width. data ColWidth ColWidth :: Double -> ColWidth ColWidthDefault :: ColWidth -- | The specification for a single table column. type ColSpec = (Alignment, ColWidth) -- | A table row. data Row Row :: Attr -> [Cell] -> Row -- | The head of a table. data TableHead TableHead :: Attr -> [Row] -> TableHead -- | A body of a table, with an intermediate head, intermediate body, and -- the specified number of row header columns in the intermediate body. data TableBody TableBody :: Attr -> RowHeadColumns -> [Row] -> [Row] -> TableBody -- | The foot of a table. data TableFoot TableFoot :: Attr -> [Row] -> TableFoot -- | A table cell. data Cell Cell :: Attr -> Alignment -> RowSpan -> ColSpan -> [Block] -> Cell -- | The number of rows occupied by a cell; the height of a cell. newtype RowSpan RowSpan :: Int -> RowSpan -- | The number of columns occupied by a cell; the width of a cell. newtype ColSpan ColSpan :: Int -> ColSpan -- | Type of quotation marks to use in Quoted inline. data QuoteType SingleQuote :: QuoteType DoubleQuote :: QuoteType -- | Link target (URL, title). type Target = (Text, Text) -- | Type of math element (display or inline). data MathType DisplayMath :: MathType InlineMath :: MathType data Citation Citation :: Text -> [Inline] -> [Inline] -> CitationMode -> Int -> Int -> Citation [citationId] :: Citation -> Text [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 Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.MetaValue instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.MetaValue instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.CitationMode instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.CitationMode instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.Citation instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.Citation instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.QuoteType instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.QuoteType instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.MathType instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.MathType instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.ListNumberStyle instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.ListNumberStyle instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.ListNumberDelim instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.ListNumberDelim instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.Alignment instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.Alignment instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.ColWidth instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.ColWidth instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.Row instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.Row instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.Caption instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.Caption instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.TableHead instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.TableHead instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.TableBody instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.TableBody instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.TableFoot instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.TableFoot instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.Cell instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.Cell instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.Inline instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.Inline instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.Block instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.Block instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.Meta instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.Meta instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.Pandoc instance Data.Aeson.Types.ToJSON.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.RowSpan instance Control.DeepSeq.NFData Text.Pandoc.Definition.ColSpan instance Control.DeepSeq.NFData Text.Pandoc.Definition.Cell instance Control.DeepSeq.NFData Text.Pandoc.Definition.Row instance Control.DeepSeq.NFData Text.Pandoc.Definition.TableHead instance Control.DeepSeq.NFData Text.Pandoc.Definition.TableBody instance Control.DeepSeq.NFData Text.Pandoc.Definition.TableFoot instance Control.DeepSeq.NFData Text.Pandoc.Definition.Caption 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.ColWidth instance Control.DeepSeq.NFData Text.Pandoc.Definition.RowHeadColumns instance Control.DeepSeq.NFData Text.Pandoc.Definition.Block instance Control.DeepSeq.NFData Text.Pandoc.Definition.Pandoc 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.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 Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.Format instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.Format 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 Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.RowHeadColumns instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.RowHeadColumns instance GHC.Enum.Enum Text.Pandoc.Definition.RowHeadColumns instance GHC.Num.Num Text.Pandoc.Definition.RowHeadColumns instance GHC.Generics.Generic Text.Pandoc.Definition.RowHeadColumns instance Data.Data.Data Text.Pandoc.Definition.RowHeadColumns instance GHC.Read.Read Text.Pandoc.Definition.RowHeadColumns instance GHC.Show.Show Text.Pandoc.Definition.RowHeadColumns instance GHC.Classes.Ord Text.Pandoc.Definition.RowHeadColumns instance GHC.Classes.Eq Text.Pandoc.Definition.RowHeadColumns 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.Generics.Generic Text.Pandoc.Definition.ColWidth instance Data.Data.Data Text.Pandoc.Definition.ColWidth instance GHC.Read.Read Text.Pandoc.Definition.ColWidth instance GHC.Show.Show Text.Pandoc.Definition.ColWidth instance GHC.Classes.Ord Text.Pandoc.Definition.ColWidth instance GHC.Classes.Eq Text.Pandoc.Definition.ColWidth instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.RowSpan instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.RowSpan instance GHC.Enum.Enum Text.Pandoc.Definition.RowSpan instance GHC.Num.Num Text.Pandoc.Definition.RowSpan instance GHC.Generics.Generic Text.Pandoc.Definition.RowSpan instance Data.Data.Data Text.Pandoc.Definition.RowSpan instance GHC.Read.Read Text.Pandoc.Definition.RowSpan instance GHC.Show.Show Text.Pandoc.Definition.RowSpan instance GHC.Classes.Ord Text.Pandoc.Definition.RowSpan instance GHC.Classes.Eq Text.Pandoc.Definition.RowSpan instance Data.Aeson.Types.FromJSON.FromJSON Text.Pandoc.Definition.ColSpan instance Data.Aeson.Types.ToJSON.ToJSON Text.Pandoc.Definition.ColSpan instance GHC.Enum.Enum Text.Pandoc.Definition.ColSpan instance GHC.Num.Num Text.Pandoc.Definition.ColSpan instance GHC.Generics.Generic Text.Pandoc.Definition.ColSpan instance Data.Data.Data Text.Pandoc.Definition.ColSpan instance GHC.Read.Read Text.Pandoc.Definition.ColSpan instance GHC.Show.Show Text.Pandoc.Definition.ColSpan instance GHC.Classes.Ord Text.Pandoc.Definition.ColSpan instance GHC.Classes.Eq Text.Pandoc.Definition.ColSpan 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.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.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.TableHead instance Data.Data.Data Text.Pandoc.Definition.TableHead instance GHC.Read.Read Text.Pandoc.Definition.TableHead instance GHC.Show.Show Text.Pandoc.Definition.TableHead instance GHC.Classes.Ord Text.Pandoc.Definition.TableHead instance GHC.Classes.Eq Text.Pandoc.Definition.TableHead instance GHC.Generics.Generic Text.Pandoc.Definition.TableBody instance Data.Data.Data Text.Pandoc.Definition.TableBody instance GHC.Read.Read Text.Pandoc.Definition.TableBody instance GHC.Show.Show Text.Pandoc.Definition.TableBody instance GHC.Classes.Ord Text.Pandoc.Definition.TableBody instance GHC.Classes.Eq Text.Pandoc.Definition.TableBody instance GHC.Generics.Generic Text.Pandoc.Definition.Cell instance Data.Data.Data Text.Pandoc.Definition.Cell instance GHC.Read.Read Text.Pandoc.Definition.Cell instance GHC.Show.Show Text.Pandoc.Definition.Cell instance GHC.Classes.Ord Text.Pandoc.Definition.Cell instance GHC.Classes.Eq Text.Pandoc.Definition.Cell instance GHC.Generics.Generic Text.Pandoc.Definition.Row instance Data.Data.Data Text.Pandoc.Definition.Row instance GHC.Read.Read Text.Pandoc.Definition.Row instance GHC.Show.Show Text.Pandoc.Definition.Row instance GHC.Classes.Ord Text.Pandoc.Definition.Row instance GHC.Classes.Eq Text.Pandoc.Definition.Row instance GHC.Generics.Generic Text.Pandoc.Definition.TableFoot instance Data.Data.Data Text.Pandoc.Definition.TableFoot instance GHC.Read.Read Text.Pandoc.Definition.TableFoot instance GHC.Show.Show Text.Pandoc.Definition.TableFoot instance GHC.Classes.Ord Text.Pandoc.Definition.TableFoot instance GHC.Classes.Eq Text.Pandoc.Definition.TableFoot instance GHC.Generics.Generic Text.Pandoc.Definition.Caption instance Data.Data.Data Text.Pandoc.Definition.Caption instance GHC.Read.Read Text.Pandoc.Definition.Caption instance GHC.Show.Show Text.Pandoc.Definition.Caption instance GHC.Classes.Ord Text.Pandoc.Definition.Caption instance GHC.Classes.Eq Text.Pandoc.Definition.Caption 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.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.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.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.Base.Semigroup Text.Pandoc.Definition.Pandoc instance GHC.Base.Monoid Text.Pandoc.Definition.Pandoc instance GHC.Base.Semigroup Text.Pandoc.Definition.Meta instance GHC.Base.Monoid Text.Pandoc.Definition.Meta instance GHC.Classes.Ord Text.Pandoc.Definition.Citation instance Data.String.IsString Text.Pandoc.Definition.Format instance GHC.Classes.Eq Text.Pandoc.Definition.Format instance GHC.Classes.Ord Text.Pandoc.Definition.Format -- | Convenience functions for building pandoc documents programmatically. -- -- Example of use (with OverloadedStrings pragma): -- --
--   import Text.Pandoc.Builder
--   
--   myDoc :: Pandoc
--   myDoc = setTitle "My title" $ doc $
--     para "This is the first paragraph" <>
--     para ("And " <> emph "another" <> ".") <>
--     bulletList [ para "item one" <> para "continuation"
--                , plain ("item two and a " <>
--                    link "/url" "go to url" "link")
--                ]
--   
-- -- Isn't that nicer than writing the following? -- --
--   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")]]]]
--   
-- -- And of course, you can use Haskell to define your own builders: -- --
--   import Text.Pandoc.Builder
--   import Text.JSON
--   import Control.Arrow ((***))
--   import Data.Monoid (mempty)
--   
--   -- | Converts a JSON document into 'Blocks'.
--   json :: String -> Blocks
--   json x =
--     case decode x of
--          Ok y    -> jsValueToBlocks y
--          Error y -> error y
--      where jsValueToBlocks x =
--             case x of
--              JSNull         -> mempty
--              JSBool x       -> plain $ text $ show x
--              JSRational _ x -> plain $ text $ show x
--              JSString x     -> plain $ text $ fromJSString x
--              JSArray xs     -> bulletList $ map jsValueToBlocks xs
--              JSObject x     -> definitionList $
--                                 map (text *** (:[]) . jsValueToBlocks) $
--                                 fromJSObject x
--   
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 associative operation. -- --
--   >>> [1,2,3] <> [4,5,6]
--   [1,2,3,4,5,6]
--   
(<>) :: Semigroup a => a -> a -> a infixr 6 <> singleton :: a -> Many a toList :: Many a -> [a] fromList :: [a] -> Many a -- | Deprecated: Use null instead isNull :: Many a -> Bool doc :: Blocks -> Pandoc class ToMetaValue a toMetaValue :: ToMetaValue a => a -> MetaValue class HasMeta a setMeta :: (HasMeta a, ToMetaValue b) => Text -> b -> a -> a deleteMeta :: HasMeta a => Text -> a -> a setTitle :: Inlines -> Pandoc -> Pandoc setAuthors :: [Inlines] -> Pandoc -> Pandoc setDate :: Inlines -> Pandoc -> Pandoc -- | Convert a Text to Inlines, treating interword spaces as -- Spaces or SoftBreaks. If you want a Str with -- literal spaces, use str. text :: Text -> Inlines str :: Text -> Inlines emph :: Inlines -> Inlines underline :: 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 -> Text -> Inlines -- | Plain inline code. code :: Text -> Inlines space :: Inlines softbreak :: Inlines linebreak :: Inlines -- | Inline math math :: Text -> Inlines -- | Display math displayMath :: Text -> Inlines rawInline :: Text -> Text -> Inlines link :: Text -> Text -> Inlines -> Inlines linkWith :: Attr -> Text -> Text -> Inlines -> Inlines image :: Text -> Text -> Inlines -> Inlines imageWith :: Attr -> Text -> Text -> 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 lineBlock :: [Inlines] -> Blocks -- | A code block with attributes. codeBlockWith :: Attr -> Text -> Blocks -- | A plain code block. codeBlock :: Text -> Blocks rawBlock :: Text -> Text -> 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 cell :: Alignment -> RowSpan -> ColSpan -> Blocks -> Cell -- | A 1×1 cell with default alignment. simpleCell :: Blocks -> Cell -- | A 1×1 empty cell. emptyCell :: Cell cellWith :: Attr -> Alignment -> RowSpan -> ColSpan -> Blocks -> Cell -- | Table builder. Performs normalization with normalizeTableHead, -- normalizeTableBody, and normalizeTableFoot. The number -- of table columns is given by the length of [ColSpec]. table :: Caption -> [ColSpec] -> TableHead -> [TableBody] -> TableFoot -> Blocks -- | A simple table without a caption. simpleTable :: [Blocks] -> [[Blocks]] -> Blocks tableWith :: Attr -> Caption -> [ColSpec] -> TableHead -> [TableBody] -> TableFoot -> Blocks figure :: Caption -> Blocks -> Blocks figureWith :: Attr -> Caption -> Blocks -> Blocks caption :: Maybe ShortCaption -> Blocks -> Caption simpleCaption :: Blocks -> Caption emptyCaption :: Caption -- | Creates a simple figure from attributes, a figure caption, an image -- path and image title. The attributes are used as the image attributes. simpleFigureWith :: Attr -> Inlines -> Text -> Text -> Blocks simpleFigure :: Inlines -> Text -> Text -> Blocks divWith :: Attr -> Blocks -> Blocks -- | Normalize the TableHead with clipRows and -- placeRowSection so that when placed on a grid with the given -- width and a height equal to the number of rows in the initial -- TableHead, there will be no empty spaces or overlapping cells, -- and the cells will not protrude beyond the grid. normalizeTableHead :: Int -> TableHead -> TableHead -- | Normalize the intermediate head and body section of a -- TableBody, as in normalizeTableHead, but additionally -- ensure that row head cells do not go beyond the row head inside the -- intermediate body. normalizeTableBody :: Int -> TableBody -> TableBody -- | Normalize the TableFoot, as in normalizeTableHead. normalizeTableFoot :: Int -> TableFoot -> TableFoot -- | Normalize the given list of cells so that they fit on a single grid -- row. The RowSpan values of the cells are assumed to be valid -- (clamped to lie between 1 and the remaining grid height). The cells in -- the list are also assumed to be able to fill the entire grid row. -- These conditions can be met by appending repeat -- emptyCell to the [Cell] list and using -- clipRows on the entire table section beforehand. -- -- Normalization follows the principle that cells are placed on a grid -- row in order, each at the first available grid position from the left, -- having their ColSpan reduced if they would overlap with a -- previous cell, stopping once the row is filled. Only the dimensions of -- cells are changed, and only of those cells that fit on the row. -- -- Possible overlap is detected using the given -- [RowSpan], which is the "overhang" of the previous -- grid row, a list of the heights of cells that descend through the -- previous row, reckoned only from the previous row. Its length -- should be the width (number of columns) of the current grid row. -- -- For example, the numbers in the following headerless grid table -- represent the overhang at each grid position for that table: -- --
--     1   1   1   1
--   +---+---+---+---+
--   | 1 | 2   2 | 3 |
--   +---+       +   +
--   | 1 | 1   1 | 2 |
--   +---+---+---+   +
--   | 1   1 | 1 | 1 |
--   +---+---+---+---+
--   
-- -- In any table, the row before the first has an overhang of -- replicate tableWidth 1, since there are no cells to descend -- into the table from there. The overhang of the first row in the -- example is [1, 2, 2, 3]. -- -- So if after clipRows the unnormalized second row of that -- example table were -- --
--   r = [("a", 1, 2),("b", 2, 3)] -- the cells displayed as (label, RowSpan, ColSpan) only
--   
-- -- a correct invocation of placeRowSection to normalize it would -- be -- --
--   >>> placeRowSection [1, 2, 2, 3] $ r ++ repeat emptyCell
--   ([1, 1, 1, 2], [("a", 1, 1)], [("b", 2, 3)] ++ repeat emptyCell) -- wouldn't stop printing, of course
--   
-- -- and if the third row were only [("c", 1, 2)], then the -- expression would be -- --
--   >>> placeRowSection [1, 1, 1, 2] $ [("c", 1, 2)] ++ repeat emptyCell
--   ([1, 1, 1, 1], [("c", 1, 2), emptyCell], repeat emptyCell)
--   
placeRowSection :: [RowSpan] -> [Cell] -> ([RowSpan], [Cell], [Cell]) -- | Ensure that the height of each cell in a table section lies between 1 -- and the distance from its row to the end of the section. So if there -- were four rows in the input list, the cells in the second row would -- have their height clamped between 1 and 3. clipRows :: [Row] -> [Row] 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.Semigroup Text.Pandoc.Builder.Blocks instance GHC.Base.Monoid Text.Pandoc.Builder.Blocks instance Text.Pandoc.Builder.HasMeta Text.Pandoc.Definition.Meta instance Text.Pandoc.Builder.HasMeta Text.Pandoc.Definition.Pandoc 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 Data.Text.Internal.Text instance Text.Pandoc.Builder.ToMetaValue GHC.Base.String instance Text.Pandoc.Builder.ToMetaValue a => Text.Pandoc.Builder.ToMetaValue [a] instance Text.Pandoc.Builder.ToMetaValue a => Text.Pandoc.Builder.ToMetaValue (Data.Map.Internal.Map Data.Text.Internal.Text a) instance Text.Pandoc.Builder.ToMetaValue a => Text.Pandoc.Builder.ToMetaValue (Data.Map.Internal.Map GHC.Base.String a) instance GHC.Base.Semigroup Text.Pandoc.Builder.Inlines instance GHC.Base.Monoid Text.Pandoc.Builder.Inlines instance Data.String.IsString Text.Pandoc.Builder.Inlines module Text.Pandoc.Arbitrary instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Builder.Inlines instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Builder.Blocks instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.Inline instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.Block instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.Pandoc instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.CitationMode instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.Citation instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.Row instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.TableHead instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.TableBody instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.TableFoot instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.Cell instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.Caption instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.MathType instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.QuoteType instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.Meta instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.Alignment instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.ListNumberStyle instance Test.QuickCheck.Arbitrary.Arbitrary Text.Pandoc.Definition.ListNumberDelim -- | Generic functions for manipulating Pandoc documents. (Note: -- the functions defined in Text.Pandoc.Walk 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: -- --
--   import Text.Pandoc.Definition
--   import Text.Pandoc.Generic
--   import Data.Char (toUpper)
--   
--   modHeader :: Block -> Block
--   modHeader (Header n _ xs) | n >= 3 = Para $ bottomUp allCaps xs
--   modHeader x = x
--   
--   allCaps :: Inline -> Inline
--   allCaps (Str xs) = Str $ map toUpper xs
--   allCaps x = x
--   
--   changeHeaders :: Pandoc -> Pandoc
--   changeHeaders = bottomUp modHeader
--   
-- -- bottomUp is so called because it traverses the Pandoc -- structure from bottom up. topDown goes the other way. The -- difference between them can be seen from this example: -- --
--   normal :: [Inline] -> [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"]]]
--   
-- -- Here we want to use topDown to lift normal to -- Pandoc -> Pandoc. The top down strategy will collapse the -- two adjacent Emphs first, then collapse the resulting -- adjacent Spaces, as desired. If we used bottomUp, we -- would end up with two adjacent Spaces, since the contents of -- the two Emph inlines would be processed before the -- Emphs were collapsed into one. -- --
--   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"]]]
--   
-- -- bottomUpM is a monadic version of bottomUp. It could be -- used, for example, to replace the contents of delimited code blocks -- with attribute include=FILENAME with the contents of -- FILENAME: -- --
--   doInclude :: Block -> IO Block
--   doInclude cb@(CodeBlock (id, classes, namevals) contents) =
--     case lookup "include" namevals of
--          Just f  -> return . (CodeBlock (id, classes, namevals)) =<< readFile f
--          Nothing -> return cb
--   doInclude x = return x
--   
--   processIncludes :: Pandoc -> IO Pandoc
--   processIncludes = bottomUpM doInclude
--   
-- -- queryWith can be used, for example, to compile a list of URLs -- linked to in a document: -- --
--   extractURL :: Inline -> [String]
--   extractURL (Link _ (u,_)) = [u]
--   extractURL (Image _ _ (u,_)) = [u]
--   extractURL _ = []
--   
--   extractURLs :: Pandoc -> [String]
--   extractURLs = queryWith extractURL
--   
module Text.Pandoc.Generic -- | Applies a transformation on as to matching elements in a -- b, moving from the bottom of the structure up. bottomUp :: (Data a, Data b) => (a -> a) -> b -> b -- | Applies a transformation on as to matching elements in a -- b, moving from the top of the structure down. topDown :: (Data a, Data b) => (a -> a) -> b -> b -- | Like bottomUp, but with monadic transformations. bottomUpM :: (Monad m, Data a, Data b) => (a -> m a) -> b -> m b -- | Runs a query on matching a elements in a c. The -- results of the queries are combined using mappend. queryWith :: (Data a, Monoid b, Data c) => (a -> b) -> c -> b -- | Functions for manipulating Pandoc documents or extracting -- information from them by walking the Pandoc structure (or -- intermediate structures like '[Block]' or '[Inline]'. These are faster -- (by a factor of four or five) than the generic functions defined in -- Text.Pandoc.Generic. -- -- Here's a simple example, defining a function that replaces all the -- level 3+ headers in a document with regular paragraphs in ALL CAPS: -- --
--   import Text.Pandoc.Definition
--   import Text.Pandoc.Walk
--   import Data.Char (toUpper)
--   
--   modHeader :: Block -> Block
--   modHeader (Header n _ xs) | n >= 3 = Para $ walk allCaps xs
--   modHeader x = x
--   
--   allCaps :: Inline -> Inline
--   allCaps (Str xs) = Str $ map toUpper xs
--   allCaps x = x
--   
--   changeHeaders :: Pandoc -> Pandoc
--   changeHeaders = walk modHeader
--   
-- -- query can be used, for example, to compile a list of URLs -- linked to in a document: -- --
--   extractURL :: Inline -> [Text]
--   extractURL (Link _ _ (u,_)) = [u]
--   extractURL (Image _ _ (u,_)) = [u]
--   extractURL _ = []
--   
--   extractURLs :: Pandoc -> [Text]
--   extractURLs = query extractURL
--   
module Text.Pandoc.Walk class Walkable a b -- | walk f x walks the structure x (bottom up) and -- replaces every occurrence of an a with the result of applying -- f to it. walk :: Walkable a b => (a -> a) -> b -> b -- | A monadic version of walk. walkM :: (Walkable a b, Monad m, Applicative m, Functor m) => (a -> m a) -> b -> m b -- | query f x walks the structure x (bottom up) and -- applies f to every a, appending the results. query :: (Walkable a b, Monoid c) => (a -> c) -> b -> c -- | Perform a query on elements nested below a Block -- element by querying all directly nested lists of Inlines or -- Blocks. queryBlock :: (Walkable a Citation, Walkable a [Block], Walkable a Row, Walkable a Caption, Walkable a TableHead, Walkable a TableBody, Walkable a TableFoot, Walkable a [Inline], Monoid c) => (a -> c) -> Block -> c -- | Query the elements below a Cell element. queryCaption :: (Walkable a [Block], Walkable a [Inline], Walkable a ShortCaption, Monoid c) => (a -> c) -> Caption -> c -- | Query the elements below a Row element. queryRow :: (Walkable a Cell, Monoid c) => (a -> c) -> Row -> c -- | Query the elements below a TableHead element. queryTableHead :: (Walkable a Row, Monoid c) => (a -> c) -> TableHead -> c -- | Query the elements below a TableBody element. queryTableBody :: (Walkable a Row, Monoid c) => (a -> c) -> TableBody -> c -- | Query the elements below a TableFoot element. queryTableFoot :: (Walkable a Row, Monoid c) => (a -> c) -> TableFoot -> c -- | Query the elements below a Cell element. queryCell :: (Walkable a [Block], Monoid c) => (a -> c) -> Cell -> c -- | Perform a query on elements nested below a Citation -- element by querying the prefix and postfix Inline lists. queryCitation :: (Walkable a [Inline], Monoid c) => (a -> c) -> Citation -> c -- | Perform a query on elements nested below an Inline -- element by querying nested lists of Inlines, Blocks, -- or Citations. queryInline :: (Walkable a Citation, Walkable a [Block], Walkable a [Inline], Monoid c) => (a -> c) -> Inline -> c -- | Perform a query on elements nested below a MetaValue -- element by querying all directly nested lists of Inlines, -- list of Blocks, or lists or maps of MetaValues. queryMetaValue :: (Walkable a MetaValue, Walkable a [Block], Walkable a [Inline], Monoid c) => (a -> c) -> MetaValue -> c -- | Perform a query on MetaValue elements nested below a -- MetaValue element queryMetaValue' :: Monoid c => (MetaValue -> c) -> MetaValue -> c -- | Query a pandoc element by recursing first into its -- Meta data and then append the result of recursing into -- the list of Blocks. queryPandoc :: (Walkable a Meta, Walkable a [Block], Monoid c) => (a -> c) -> Pandoc -> c -- | Helper method to walk to elements nested below Block -- nodes. -- -- When walking a block with this function, only the contents of the -- traversed block element may change. The element itself, i.e. its -- constructor, its Attr, and its raw text value, will -- remain unchanged. walkBlockM :: (Walkable a [Block], Walkable a [Inline], Walkable a Row, Walkable a Caption, Walkable a TableHead, Walkable a TableBody, Walkable a TableFoot, Monad m, Applicative m, Functor m) => (a -> m a) -> Block -> m Block -- | Helper method to walk the elements nested below Caption nodes. walkCaptionM :: (Walkable a [Block], Walkable a [Inline], Monad m, Walkable a ShortCaption) => (a -> m a) -> Caption -> m Caption -- | Helper method to walk the elements nested below Row -- nodes. The Attr component is not changed by this -- operation. walkRowM :: (Walkable a Cell, Monad m) => (a -> m a) -> Row -> m Row -- | Helper method to walk the elements nested below -- TableHead nodes. The Attr component is -- not changed by this operation. walkTableHeadM :: (Walkable a Row, Monad m) => (a -> m a) -> TableHead -> m TableHead -- | Helper method to walk the elements nested below -- TableBody nodes. The Attr and -- RowHeadColumns components are not changed by this -- operation. walkTableBodyM :: (Walkable a Row, Monad m) => (a -> m a) -> TableBody -> m TableBody -- | Helper method to walk the elements nested below -- TableFoot nodes. The Attr component is -- not changed by this operation. walkTableFootM :: (Walkable a Row, Monad m) => (a -> m a) -> TableFoot -> m TableFoot -- | Helper method to walk the elements nested below Cell nodes. -- Only the [Block] cell content is changed by this -- operation. walkCellM :: (Walkable a [Block], Monad m) => (a -> m a) -> Cell -> m Cell -- | Helper method to walk to elements nested below -- Citation nodes. -- -- The non-inline contents of a citation will remain unchanged during -- traversal. Only the inline contents, viz. the citation's prefix and -- postfix, will be traversed further and can thus be changed during this -- operation. walkCitationM :: (Walkable a [Inline], Monad m, Applicative m, Functor m) => (a -> m a) -> Citation -> m Citation -- | Helper method to walk to elements nested below Inline -- nodes. -- -- When walking an inline with this function, only the contents of the -- traversed inline element may change. The element itself, i.e. its -- constructor, cannot be changed. walkInlineM :: (Walkable a Citation, Walkable a [Block], Walkable a [Inline], Monad m, Applicative m, Functor m) => (a -> m a) -> Inline -> m Inline -- | Helper method to walk to elements nested below -- MetaValue nodes. -- -- When walking a meta value with this function, only the contents of the -- traversed meta value element may change. MetaBool and -- MetaString will always remain unchanged. walkMetaValueM :: (Walkable a MetaValue, Walkable a [Block], Walkable a [Inline], Monad f, Applicative f, Functor f) => (a -> f a) -> MetaValue -> f MetaValue -- | Helper method to walk MetaValue nodes nested below -- MetaValue nodes. walkMetaValueM' :: (Monad f, Applicative f, Functor f) => (MetaValue -> f MetaValue) -> MetaValue -> f MetaValue -- | Helper method to walk the components of a Pandoc element. walkPandocM :: (Walkable a Meta, Walkable a [Block], Monad m, Applicative m, Functor m) => (a -> m a) -> Pandoc -> m Pandoc 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.Inline] 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.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.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.Inline instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Block Text.Pandoc.Definition.Pandoc 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.Inline] Text.Pandoc.Definition.Pandoc instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Meta Text.Pandoc.Definition.Pandoc instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.MetaValue 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.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.Block] Text.Pandoc.Definition.Meta instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.MetaValue Text.Pandoc.Definition.Meta instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.MetaValue Text.Pandoc.Definition.MetaValue instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Inline Text.Pandoc.Definition.MetaValue 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.Block] Text.Pandoc.Definition.MetaValue instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Inline Text.Pandoc.Definition.Row instance Text.Pandoc.Walk.Walkable [Text.Pandoc.Definition.Inline] Text.Pandoc.Definition.Row instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Block Text.Pandoc.Definition.Row instance Text.Pandoc.Walk.Walkable [Text.Pandoc.Definition.Block] Text.Pandoc.Definition.Row instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Inline Text.Pandoc.Definition.TableHead instance Text.Pandoc.Walk.Walkable [Text.Pandoc.Definition.Inline] Text.Pandoc.Definition.TableHead instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Block Text.Pandoc.Definition.TableHead instance Text.Pandoc.Walk.Walkable [Text.Pandoc.Definition.Block] Text.Pandoc.Definition.TableHead instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Inline Text.Pandoc.Definition.TableBody instance Text.Pandoc.Walk.Walkable [Text.Pandoc.Definition.Inline] Text.Pandoc.Definition.TableBody instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Block Text.Pandoc.Definition.TableBody instance Text.Pandoc.Walk.Walkable [Text.Pandoc.Definition.Block] Text.Pandoc.Definition.TableBody instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Inline Text.Pandoc.Definition.TableFoot instance Text.Pandoc.Walk.Walkable [Text.Pandoc.Definition.Inline] Text.Pandoc.Definition.TableFoot instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Block Text.Pandoc.Definition.TableFoot instance Text.Pandoc.Walk.Walkable [Text.Pandoc.Definition.Block] Text.Pandoc.Definition.TableFoot instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Inline Text.Pandoc.Definition.Caption instance Text.Pandoc.Walk.Walkable [Text.Pandoc.Definition.Inline] Text.Pandoc.Definition.Caption instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Block Text.Pandoc.Definition.Caption instance Text.Pandoc.Walk.Walkable [Text.Pandoc.Definition.Block] Text.Pandoc.Definition.Caption instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Inline Text.Pandoc.Definition.Cell instance Text.Pandoc.Walk.Walkable [Text.Pandoc.Definition.Inline] Text.Pandoc.Definition.Cell instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Block Text.Pandoc.Definition.Cell instance Text.Pandoc.Walk.Walkable [Text.Pandoc.Definition.Block] Text.Pandoc.Definition.Cell instance Text.Pandoc.Walk.Walkable Text.Pandoc.Definition.Inline Text.Pandoc.Definition.Citation 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 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 (capitalize.hs) 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 -- --
--   pandoc -t json | runghc capitalize.hs | pandoc -f json
--   
-- -- or (making capitalize.hs executable) -- --
--   pandoc --filter ./capitalize.hs
--   
-- --
--   #!/usr/bin/env runghc
--   import Text.Pandoc.JSON
--   import Data.Char (toUpper)
--   
--   main :: IO ()
--   main = toJSONFilter capitalizeStrings
--   
--   capitalizeStrings :: Inline -> Inline
--   capitalizeStrings (Str s) = Str $ map toUpper s
--   capitalizeStrings x       = x
--   
module Text.Pandoc.JSON -- | toJSONFilter 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 a -> -- a or a -> IO a where a = Block, -- Inline, Pandoc, Meta, or MetaValue. -- -- If your transformation needs to be sensitive to the script's -- arguments, use a function of type [String] -> a -> a -- (with a constrained as above). The [String] will be -- populated with the script's arguments. -- -- An alternative is to use the type Maybe Format -> a -> -- a. 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 m a toJSONFilter :: ToJSONFilter m a => a -> m () instance (Text.Pandoc.Walk.Walkable a Text.Pandoc.Definition.Pandoc, Control.Monad.IO.Class.MonadIO m) => Text.Pandoc.JSON.ToJSONFilter m (a -> a) instance (Text.Pandoc.Walk.Walkable [a] Text.Pandoc.Definition.Pandoc, Control.Monad.IO.Class.MonadIO m) => Text.Pandoc.JSON.ToJSONFilter m (a -> [a]) instance (Text.Pandoc.Walk.Walkable a Text.Pandoc.Definition.Pandoc, Control.Monad.IO.Class.MonadIO m) => Text.Pandoc.JSON.ToJSONFilter m (a -> m a) instance (Text.Pandoc.Walk.Walkable [a] Text.Pandoc.Definition.Pandoc, Control.Monad.IO.Class.MonadIO m) => Text.Pandoc.JSON.ToJSONFilter m (a -> m [a]) instance (Text.Pandoc.JSON.ToJSONFilter m a, Control.Monad.IO.Class.MonadIO m) => Text.Pandoc.JSON.ToJSONFilter m ([GHC.Base.String] -> a) instance (Text.Pandoc.JSON.ToJSONFilter m a, Control.Monad.IO.Class.MonadIO m) => Text.Pandoc.JSON.ToJSONFilter m (GHC.Maybe.Maybe Text.Pandoc.Definition.Format -> a)