Text.Pandoc.Lua.Marshal.Content

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

Copyright | © 2021-2024 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 #

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 #

Gets the text property of an Inline, if present.

peekContent :: LuaError e => Peeker e Content #

Gets a `Content` element from the stack.

pushContent :: LuaError e => Pusher e Content #

Pushes the `Content` to the stack.

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

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.