Search code examples
luapandoc

Manipulate `Block` in pandoc lua filter


In a pandoc-filter, is it possible to change a Block object that I receive with

-- div.content is a list of Blocks, see [1]
local elem = table.remove(div.content, 1)

with elem being a BlockQuote [Para [Str "Text"]] to something like Para [Str "Text"]? In short, remove the Blockquote object around the Para?



Solution

  • Having had a search around the net, it seems from Pandoc Lua Filters, that the element has a property t that seems to stand for tag or type maybe and a property c standing for content, an array style table containing each child element.

    So in this case elem.c[1] would be the first child element.