Skip to content

Instantly share code, notes, and snippets.

@bakaburg1
Last active February 28, 2022 15:24
Show Gist options
  • Save bakaburg1/9df96ad28f0a83c6594e582c56ace304 to your computer and use it in GitHub Desktop.
Save bakaburg1/9df96ad28f0a83c6594e582c56ace304 to your computer and use it in GitHub Desktop.
A filter to store image captions into the Meta fields
function RawBlock (raw)
local caption = raw.text:match("\\caption%{[^%}]+%}")
if caption then
captions:insert(caption)
end
end
function Pandoc (doc)
-- append collected captions at the end
doc.meta.figures = captions -- This works but latex is escaped by \textbackslash
-- doc.meta.figures = {pandoc.RawBlock("latex", captions)} -- This produces error
return doc
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment