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


-- | Use pandoc types in Lua
--   
--   This package provides functions to marshal and unmarshal pandoc
--   document types to and from Lua.
--   
--   The values of most types are pushed to pandoc as "userdata" objects
--   that wrap a stable pointer to the Haskell value; these objects come
--   with methods to access and modify their properties.
--   
--   Sequences are pushed as normal Lua tables, but are augmented with
--   convenience functions.
@package pandoc-lua-marshal
@version 0.2.7.1


-- | Marshaling/unmarshaling functions of <a>Alignment</a> values.
module Text.Pandoc.Lua.Marshal.Alignment

-- | Retrieves a <a>Alignment</a> value from a string.
peekAlignment :: Peeker e Alignment

-- | Pushes a <a>Alignment</a> value as a string.
pushAlignment :: Pusher e Alignment


-- | Marshaling/unmarshaling functions of <a>CitationMode</a> values.
module Text.Pandoc.Lua.Marshal.CitationMode

-- | Retrieves a Citation value from a string.
peekCitationMode :: Peeker e CitationMode

-- | Pushes a CitationMode value as string.
pushCitationMode :: Pusher e CitationMode


-- | Marshaling/unmarshaling functions Lua filters, i.e., tables containing
--   functions to be called on specific elements.
module Text.Pandoc.Lua.Marshal.Filter

-- | Collection of filter functions (at most one function per element
--   constructor)
data Filter
Filter :: WalkingOrder -> Map Name FilterFunction -> Filter
[filterWalkingOrder] :: Filter -> WalkingOrder
[filterMap] :: Filter -> Map Name FilterFunction

-- | Description of how an AST should be traversed.
data WalkingOrder

-- | Process each type separately, traversing the tree bottom-up (leaves to
--   root) for each type.
WalkForEachType :: WalkingOrder

-- | Traverse the tree top-down, from root to leaves and depth first, in a
--   single traversal.
WalkTopdown :: WalkingOrder

-- | Retrieves a default <a>Filter</a> object from the stack, suitable for
--   filtering a full document.
peekFilter :: LuaError e => Peeker e Filter

-- | Looks up a filter function in a Lua <a>Filter</a>.
lookup :: Name -> Filter -> Maybe FilterFunction

-- | Checks whether the <a>Filter</a> contains a function of the given
--   name.
member :: Name -> Filter -> Bool

-- | Filter function stored in the registry
newtype FilterFunction
FilterFunction :: Reference -> FilterFunction

-- | Retrieves a filter function from the stack.
--   
--   The value at the given index must be a function. It is stored in the
--   Lua registry.
peekFilterFunction :: Peeker e FilterFunction

-- | Pushes a filter function to the stack.
--   
--   Filter functions are stored in the registry and retrieved from there.
pushFilterFunction :: LuaError e => FilterFunction -> LuaE e ()

-- | Finds the best filter function for a given element; returns
--   <a>Nothing</a> if no such function exists.
getFunctionFor :: forall a. Data a => Filter -> a -> Maybe FilterFunction

-- | The name of a type's base function, which is called if there is no
--   more specific function for a value.
baseFunctionName :: forall a. Data a => Proxy a -> Name

-- | The name of the functions that's called on lists of the given type.
listFunctionName :: forall a. Data a => Proxy a -> Name

-- | Filter function names for a given type.
valueFunctionNames :: forall a. Data a => Proxy a -> [Name]


-- | Marshaling/unmarshaling functions of <a>Format</a> values.
module Text.Pandoc.Lua.Marshal.Format

-- | Retrieves a <a>Format</a> value from a string.
peekFormat :: Peeker e Format

-- | Pushes a <a>Format</a> value as a string.
pushFormat :: Pusher e Format


-- | Lua lists with additional methods.
module Text.Pandoc.Lua.Marshal.List

-- | Pushes a list as a numerically-indexed Lua table, and sets a metatable
--   that offers a number of convenience functions.
pushPandocList :: LuaError e => Pusher e a -> Pusher e [a]


-- | Helpers to make pandoc's Attr elements usable in Lua, and to get
--   objects back into Haskell.
module Text.Pandoc.Lua.Marshal.Attr

-- | Attr object type.
typeAttr :: LuaError e => DocumentedType e Attr

-- | Retrieves an <a>Attr</a> value from a string, a table, or an
--   <tt>Attr</tt> userdata object. A string is used as an identifier; a
--   table is either an HTML-like set of attributes, or a triple containing
--   the identifier, classes, and attributes.
peekAttr :: LuaError e => Peeker e Attr

-- | Pushes an <a>Attr</a> value as <tt>Attr</tt> userdata object.
pushAttr :: LuaError e => Pusher e Attr

-- | Constructor functions for <tt>AttributeList</tt> elements.
typeAttributeList :: LuaError e => DocumentedType e [(Text, Text)]

-- | Pushes an associated list of attributes as <tt>AttributeList</tt>
--   userdata object.
pushAttributeList :: LuaError e => Pusher e [(Text, Text)]

-- | Retrieves an associated list of attributes from a table or an
--   <tt>AttributeList</tt> userdata object.
peekAttributeList :: LuaError e => Peeker e [(Text, Text)]

-- | Constructor for <a>Attr</a>.
mkAttr :: LuaError e => DocumentedFunction e

-- | Constructor for <tt>AttributeList</tt>.
mkAttributeList :: LuaError e => DocumentedFunction e


-- | Marshaling/unmarshaling functions and constructor for
--   <a>ListAttributes</a> values.
module Text.Pandoc.Lua.Marshal.ListAttributes

-- | <a>ListAttributes</a> Lua object type.
typeListAttributes :: LuaError e => DocumentedType e ListAttributes

-- | Retrieve a <a>ListAttributes</a> triple, either from userdata or from
--   a Lua tuple.
peekListAttributes :: LuaError e => Peeker e ListAttributes

-- | Pushes a <a>ListAttributes</a> value as userdata object.
pushListAttributes :: LuaError e => Pusher e ListAttributes

-- | Constructor for a new <a>ListAttributes</a> value.
mkListAttributes :: LuaError e => DocumentedFunction e

-- | Retrieves a <a>ListNumberDelim</a> value from a string.
peekListNumberDelim :: Peeker e ListNumberDelim

-- | Pushes a <a>ListNumberDelim</a> value as string.
pushListNumberDelim :: Pusher e ListNumberDelim

-- | Retrieves a <a>ListNumberStyle</a> value from a string.
peekListNumberStyle :: Peeker e ListNumberStyle

-- | Pushes a <a>ListNumberStyle</a> value as string.
pushListNumberStyle :: Pusher e ListNumberStyle


-- | Marshaling/unmarshaling functions of <a>MathType</a> values.
module Text.Pandoc.Lua.Marshal.MathType

-- | Retrieves a <a>MathType</a> value from a string.
peekMathType :: Peeker e MathType

-- | Pushes a <a>MathType</a> value as a string.
pushMathType :: Pusher e MathType


-- | Marshaling/unmarshaling functions of <a>QuoteType</a> values.
module Text.Pandoc.Lua.Marshal.QuoteType

-- | Retrieves a <a>QuoteType</a> value from a string.
peekQuoteType :: Peeker e QuoteType

-- | Pushes a <a>QuoteType</a> value as a string.
pushQuoteType :: Pusher e QuoteType


-- | Marshaling/unmarshaling functions and constructor for <a>Citation</a>
--   values.
module Text.Pandoc.Lua.Marshal.Citation

-- | Retrieves a Citation value.
peekCitation :: LuaError e => Peeker e Citation

-- | Pushes a Citation value as userdata object.
pushCitation :: LuaError e => Pusher e Citation

-- | Citation object type.
typeCitation :: LuaError e => DocumentedType e Citation

-- | Constructor function for <a>Citation</a> elements.
mkCitation :: LuaError e => DocumentedFunction e


-- | Defines a helper type that can handle different types of <a>Block</a>
--   and <a>Inline</a> element contents.
module Text.Pandoc.Lua.Marshal.Content

-- | Helper type to represent all the different types a <tt>content</tt>
--   attribute can have.
data Content
ContentBlocks :: [Block] -> Content
ContentInlines :: [Inline] -> Content
ContentLines :: [[Inline]] -> Content
ContentDefItems :: [([Inline], [[Block]])] -> Content
ContentListItems :: [[Block]] -> Content

-- | Returns a human-readable type description; used for error messages.
contentTypeDescription :: Content -> String

-- | Gets a <a>Content</a> element from the stack.
peekContent :: LuaError e => Peeker e Content

-- | Pushes the <a>Content</a> to the stack.
pushContent :: LuaError e => Pusher e Content

-- | Retrieves a single definition item from the stack; it is expected to
--   be a pair of a list of inlines and a list of list of blocks. Uses
--   fuzzy parsing, i.e., tries hard to convert mismatching types into the
--   expected result.
peekDefinitionItem :: LuaError e => Peeker e ([Inline], [[Block]])


-- | Marshal values of types that make up <a>Inline</a> elements.
module Text.Pandoc.Lua.Marshal.Inline

-- | Inline object type.
typeInline :: forall e. LuaError e => DocumentedType e Inline

-- | Retrieves an Inline value.
peekInline :: LuaError e => Peeker e Inline

-- | Try extra hard to retrieve an Inline value from the stack. Treats bare
--   strings as <tt>Str</tt> values.
peekInlineFuzzy :: LuaError e => Peeker e Inline

-- | Pushes an Inline value as userdata object.
pushInline :: LuaError e => Pusher e Inline

-- | Retrieves a list of Inline values.
peekInlines :: LuaError e => Peeker e [Inline]

-- | Try extra-hard to return the value at the given index as a list of
--   inlines.
peekInlinesFuzzy :: LuaError e => Peeker e [Inline]

-- | Pushes a list of Inline values.
pushInlines :: LuaError e => Pusher e [Inline]

-- | Constructor functions for <a>Inline</a> elements.
inlineConstructors :: LuaError e => [DocumentedFunction e]

-- | Constructor for a list of <a>Inline</a> values.
mkInlines :: LuaError e => DocumentedFunction e

-- | Walks an element of type <tt>a</tt> and applies the filter to all
--   <a>Inline</a> elements. The filter result is spliced back into the
--   list.
walkInlineSplicing :: (LuaError e, Walkable (SpliceList Inline) a) => Filter -> a -> LuaE e a

-- | Walks an element of type <tt>a</tt> and applies the filter to all
--   lists of <a>Inline</a> elements.
walkInlinesStraight :: (LuaError e, Walkable [Inline] a) => Filter -> a -> LuaE e a


-- | Marshaling/unmarshaling functions of table <a>Cell</a> values.
module Text.Pandoc.Lua.Marshal.Cell

-- | Retrieves a <a>Cell</a> object from the stack.
peekCell :: LuaError e => Peeker e Cell

-- | Retrieves a <a>Cell</a> from the stack, accepting either a 'pandoc
--   Cell' userdata object or a table with fields <tt>attr</tt>,
--   <tt>alignment</tt>, <tt>row_span</tt>, <tt>col_span</tt>, and
--   <tt>contents</tt>.
peekCellFuzzy :: LuaError e => Peeker e Cell

-- | Push a table cell as a table with fields <tt>attr</tt>,
--   <tt>alignment</tt>, <tt>row_span</tt>, <tt>col_span</tt>, and
--   <tt>contents</tt>.
pushCell :: LuaError e => Cell -> LuaE e ()

-- | Cell object type.
typeCell :: LuaError e => DocumentedType e Cell

-- | Constructor function for <a>Cell</a> values.
mkCell :: LuaError e => DocumentedFunction e


-- | Marshaling/unmarshaling functions of <a>Row</a> values.
module Text.Pandoc.Lua.Marshal.Row

-- | Retrieves a <a>Cell</a> object from the stack.
peekRow :: LuaError e => Peeker e Row

-- | Retrieves a <a>Cell</a> from the stack, accepting either a 'pandoc
--   Cell' userdata object or a table with fields <tt>attr</tt>,
--   <tt>alignment</tt>, <tt>row_span</tt>, <tt>col_span</tt>, and
--   <tt>contents</tt>.
peekRowFuzzy :: LuaError e => Peeker e Row

-- | Push a table Row as a table with fields <tt>attr</tt>,
--   <tt>alignment</tt>, <tt>row_span</tt>, <tt>col_span</tt>, and
--   <tt>contents</tt>.
pushRow :: LuaError e => Row -> LuaE e ()

-- | Row object type.
typeRow :: LuaError e => DocumentedType e Row

-- | Constructor function for <a>Row</a> values.
mkRow :: LuaError e => DocumentedFunction e


-- | Marshaling/unmarshaling functions of <a>TableHead</a> values.
module Text.Pandoc.Lua.Marshal.TableHead

-- | Retrieves a <a>Cell</a> from the stack.
peekTableHead :: LuaError e => Peeker e TableHead

-- | Push a TableHead as a userdata value.
pushTableHead :: LuaError e => TableHead -> LuaE e ()

-- | Row object type.
typeTableHead :: LuaError e => DocumentedType e TableHead

-- | Constructor function for <a>Row</a> values.
mkTableHead :: LuaError e => DocumentedFunction e


-- | Marshaling/unmarshaling functions of <a>TableFoot</a> values.
module Text.Pandoc.Lua.Marshal.TableFoot

-- | Retrieves a <a>Cell</a> from the stack.
peekTableFoot :: LuaError e => Peeker e TableFoot

-- | Push a TableFoot as a userdata value.
pushTableFoot :: LuaError e => TableFoot -> LuaE e ()

-- | Row object type.
typeTableFoot :: LuaError e => DocumentedType e TableFoot

-- | Constructor function for <a>Row</a> values.
mkTableFoot :: LuaError e => DocumentedFunction e


-- | Marshaling/unmarshaling functions of types that are used exclusively
--   with tables.
module Text.Pandoc.Lua.Marshal.TableParts

-- | Peek Caption element
peekCaption :: LuaError e => Peeker e Caption
peekCaptionFuzzy :: LuaError e => Peeker e Caption

-- | Push Caption element
pushCaption :: LuaError e => Caption -> LuaE e ()

-- | Peek a ColSpec value as a pair of Alignment and ColWidth.
peekColSpec :: LuaError e => Peeker e ColSpec

-- | Push a ColSpec value as a pair of Alignment and ColWidth.
pushColSpec :: LuaError e => Pusher e ColSpec

-- | Retrieves a <a>Cell</a> object from the stack.
peekRow :: LuaError e => Peeker e Row

-- | Retrieves a <a>Cell</a> from the stack, accepting either a 'pandoc
--   Cell' userdata object or a table with fields <tt>attr</tt>,
--   <tt>alignment</tt>, <tt>row_span</tt>, <tt>col_span</tt>, and
--   <tt>contents</tt>.
peekRowFuzzy :: LuaError e => Peeker e Row

-- | Push a table Row as a table with fields <tt>attr</tt>,
--   <tt>alignment</tt>, <tt>row_span</tt>, <tt>col_span</tt>, and
--   <tt>contents</tt>.
pushRow :: LuaError e => Row -> LuaE e ()

-- | Retrieves a <a>TableBody</a> value from a Lua table with fields
--   <tt>attr</tt>, <tt>row_head_columns</tt>, <tt>head</tt>, and
--   <tt>body</tt>.
peekTableBody :: LuaError e => Peeker e TableBody

-- | Pushes a <a>TableBody</a> value as a Lua table with fields
--   <tt>attr</tt>, <tt>row_head_columns</tt>, <tt>head</tt>, and
--   <tt>body</tt>.
pushTableBody :: LuaError e => Pusher e TableBody

-- | Retrieves a <a>Cell</a> from the stack.
peekTableFoot :: LuaError e => Peeker e TableFoot

-- | Push a TableFoot as a userdata value.
pushTableFoot :: LuaError e => TableFoot -> LuaE e ()

-- | Retrieves a <a>Cell</a> from the stack.
peekTableHead :: LuaError e => Peeker e TableHead

-- | Push a TableHead as a userdata value.
pushTableHead :: LuaError e => TableHead -> LuaE e ()

-- | Constructor function for <a>Row</a> values.
mkRow :: LuaError e => DocumentedFunction e

-- | Constructor function for <a>Row</a> values.
mkTableFoot :: LuaError e => DocumentedFunction e

-- | Constructor function for <a>Row</a> values.
mkTableHead :: LuaError e => DocumentedFunction e


-- | Marshal values of types that make up <a>Block</a> elements.
module Text.Pandoc.Lua.Marshal.Block

-- | Block object type.
typeBlock :: forall e. LuaError e => DocumentedType e Block

-- | Retrieves an Block value.
peekBlock :: LuaError e => Peeker e Block

-- | Try extra hard to retrieve an Block value from the stack. Treats bare
--   strings as <tt>Str</tt> values.
peekBlockFuzzy :: LuaError e => Peeker e Block

-- | Pushes an Block value as userdata object.
pushBlock :: LuaError e => Pusher e Block

-- | Retrieves a list of Block values.
peekBlocks :: LuaError e => Peeker e [Block]

-- | Try extra-hard to return the value at the given index as a list of
--   inlines.
peekBlocksFuzzy :: LuaError e => Peeker e [Block]

-- | Pushes a list of Block values.
pushBlocks :: LuaError e => Pusher e [Block]

-- | Constructor functions for <a>Block</a> elements.
blockConstructors :: LuaError e => [DocumentedFunction e]

-- | Constructor for a list of <a>Block</a> values.
mkBlocks :: LuaError e => DocumentedFunction e
walkBlockSplicing :: (LuaError e, Walkable (SpliceList Block) a) => Filter -> a -> LuaE e a
walkBlocksStraight :: (LuaError e, Walkable [Block] a) => Filter -> a -> LuaE e a


-- | Definition and marshaling of the <a>SimpleTable</a> data type used as
--   a convenience type when dealing with tables.
module Text.Pandoc.Lua.Marshal.SimpleTable

-- | A simple (legacy-style) table.
data SimpleTable
SimpleTable :: [Inline] -> [Alignment] -> [Double] -> [[Block]] -> [[[Block]]] -> SimpleTable
[simpleTableCaption] :: SimpleTable -> [Inline]
[simpleTableAlignments] :: SimpleTable -> [Alignment]
[simpleTableColumnWidths] :: SimpleTable -> [Double]
[simpleTableHeader] :: SimpleTable -> [[Block]]
[simpleTableBody] :: SimpleTable -> [[[Block]]]

-- | Retrieve a simple table from the stack.
peekSimpleTable :: forall e. LuaError e => Peeker e SimpleTable

-- | Push a simple table to the stack by calling the
--   <tt>pandoc.SimpleTable</tt> constructor.
pushSimpleTable :: forall e. LuaError e => SimpleTable -> LuaE e ()

-- | Constructor for the <a>SimpleTable</a> type.
mkSimpleTable :: LuaError e => DocumentedFunction e
instance GHC.Show.Show Text.Pandoc.Lua.Marshal.SimpleTable.SimpleTable
instance GHC.Classes.Eq Text.Pandoc.Lua.Marshal.SimpleTable.SimpleTable


-- | Marshaling/unmarshaling functions of <a>MetaValue</a> elements.
module Text.Pandoc.Lua.Marshal.MetaValue

-- | Retrieves the value at the given stack index as <a>MetaValue</a>.
peekMetaValue :: forall e. LuaError e => Peeker e MetaValue

-- | Push a <a>MetaValue</a> element to the top of the Lua stack.
pushMetaValue :: LuaError e => Pusher e MetaValue

-- | Constructor functions for <a>MetaValue</a> elements.
metaValueConstructors :: LuaError e => [DocumentedFunction e]


-- | Marshaling/unmarshaling functions of <a>Pandoc</a> values.
module Text.Pandoc.Lua.Marshal.Pandoc

-- | Pandoc object type.
typePandoc :: LuaError e => DocumentedType e Pandoc

-- | Retrieves a <a>Pandoc</a> document from a userdata value.
peekPandoc :: LuaError e => Peeker e Pandoc

-- | Pushes a <a>Pandoc</a> value as userdata.
pushPandoc :: LuaError e => Pusher e Pandoc

-- | Constructor function for <a>Pandoc</a> values.
mkPandoc :: LuaError e => DocumentedFunction e

-- | Retrieves a <a>Meta</a> value from a string-indexed table.
peekMeta :: LuaError e => Peeker e Meta

-- | Pushes a <a>Meta</a> value as a string-indexed table.
pushMeta :: LuaError e => Pusher e Meta

-- | Constructor for <a>Meta</a> values.
mkMeta :: LuaError e => DocumentedFunction e

-- | Apply all components of a Lua filter.
--   
--   These operations are run in order:
--   
--   <ul>
--   <li>Inline filter functions are applied to Inline elements, splicing
--   the result back into the list of Inline elements</li>
--   <li>The <tt>Inlines</tt> function is applied to all lists of
--   Inlines.</li>
--   <li>Block filter functions are applied to Block elements, splicing the
--   result back into the list of Block elements</li>
--   <li>The <tt>Blocks</tt> function is applied to all lists of
--   Blocks.</li>
--   <li>The <tt>Meta</tt> function is applied to the <a>Meta</a>
--   part.</li>
--   <li>The <tt>Pandoc</tt> function is applied to the full <a>Pandoc</a>
--   element.</li>
--   </ul>
applyFully :: LuaError e => Filter -> Pandoc -> LuaE e Pandoc


-- | Use pandoc types in Lua
module Text.Pandoc.Lua.Marshal.AST
