Hello!
I have a problem the documentation doesn't seem to help with.
I am creating an epub from markdown, but I want to replace the titlepage
with a pre-made image.
The approach I thought I would take was this:
1) I can't quite work out how to get at the titlepage from a filter, since
that's specific to the epub writer. So instead I use a custom template for
epub3 output and replace the default titlepage with the following:
[...]
$if(titlepage)$
[...]
2) Run pandoc with a key 'epub_title_page_image' in the metadata, pointing
to the pre-made image. I thought that by using this lua filter, the image
would be added to the mediabag.
function Meta (meta)
local titlepage_path =
pandoc.utils.stringify(meta["epub_title_page_image"])
local mimetype, contents = pandoc.mediabag.fetch(titlepage_path, ".")
pandoc.mediabag.insert("titlepage.png", mimetype, contents)
return meta
end
This doesn't seem to work. Checking with asserts, the image exists and is
found by pandoc.mediabag.fetch. Then it is successfully added to the
mediabag.
But the output epub doesn't have 'titlepage.png' included in the media
directory.
The only clue that I can find in the documentation is that 'the
pandoc.mediabag
module allows access to the “mediabag,” which stores binary content such
as images that *may* be included in the final document.'
My best guess is that the epub writer checks to see if files in the
mediabag are being used, and finding no apparent use here, discards
titlepage.png. But I can't read Haskell, and I haven't seen such checks in
my attempts to understand at the writer source.
Is it instead something to do with returning an unchanged value for meta in
the filter?
If so, or if not, does anyone happen to know a good way to manage this?
Thanks!
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/2466a754-96ab-4b5e-a887-5dba4d486867%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.