pandoc-lua-marshal-0.3.1: Use pandoc types in Lua

Copyright | © 2021-2025 Albert Krewinkel
License | MIT
Maintainer | Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
Safe Haskell | None
Language | Haskell2010

Text.Pandoc.Lua.Marshal.Content

Description

Defines a helper type that can handle different types of `Block` and `Inline` element contents.

Synopsis

- data Content
  - = ContentBlocks [Block]
  - | ContentInlines [Inline]
  - | ContentLines [[Inline]]
  - | ContentDefItems [([Inline], [[Block]])]
  - | ContentListItems [[Block]]
- contentTypeDescription :: Content -> String
- peekContent :: LuaError e => Peeker e Content
- pushContent :: LuaError e => Pusher e Content
- peekDefinitionItem :: LuaError e => Peeker e ([Inline], [[Block]])

# Documentation

data Content Source #

Helper type to represent all the different types a `content` attribute can have.

Constructors

ContentBlocks [Block] |
ContentInlines [Inline] |
ContentLines [[Inline]] |
ContentDefItems [([Inline], [[Block]])] |
ContentListItems [[Block]] |

contentTypeDescription :: Content -> String Source #

Returns a human-readable type description; used for error messages.

peekContent :: LuaError e => Peeker e Content Source #

Gets a `Content` element from the stack.

pushContent :: LuaError e => Pusher e Content Source #

Pushes the `Content` to the stack.

peekDefinitionItem :: LuaError e => Peeker e ([Inline], [[Block]]) Source #

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.