public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: Paul <freack1208-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	pandoc-discuss
	<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: How do I use media bags?
Date: Tue, 01 May 2018 10:42:44 -0700	[thread overview]
Message-ID: <yh480kpo2f1dd7.fsf@johnmacfarlane.net> (raw)
In-Reply-To: <8bd93e89-5f06-4c39-9e68-1191cbe6df60-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>

Paul <freack1208-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Thanks for pointing that out! Now I got it to almost work. The epub is 
> being generated and it contains images, but it seems to like using images 
> where they shouldn't be (not like randomly adding images, but using the 
> wrong image). Are there collisions between the images? If so, is that 
> something one can fix?

The mediabag code was designed with the idea that you'd be extracting
media from one file and doing something with it.  Thus, insertMedia
just uses Data.Map.insert with the normalized file path. If two docx
files have different images with the same filename, and you read
both of them in, you'll get a collision in the media bag
and unwanted results.

Perhaps this is something that could be improved.  For example,
insertMedia could be modified to return a filename, perhaps
modified if there's already an item with that name.  This would
require some modifications across several readers.
@jkr @mpickering @tarleb - any thoughts?

In the mean time, your best bet would be to postprocess the Pandoc
structure after each docx is read using a filter, changing the
image names systematically in both the Image elements and the
MediaBag, to avoid collisions.


      parent reply	other threads:[~2018-05-01 17:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01  0:53 Paul
     [not found] ` <9bd0cbe0-31dd-45bd-be19-6d4fcc49bbec-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-05-01  1:53   ` John MacFarlane
     [not found]     ` <m236zc87lb.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2018-05-01 12:16       ` Paul
     [not found]         ` <b1d8abc3-8255-40ff-a1ba-075dceace535-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-05-01 12:44           ` Ivan Lazar Miljenovic
     [not found]             ` <CA+u6gbxA-M2c-jz7AhWbCg_FgUPDdXOG1-mqz8kDQk20Oh0-Lg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-05-01 16:15               ` Paul
     [not found]                 ` <2408d89d-5ad5-430d-8b01-7c24e2167773-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-05-01 22:06                   ` Ivan Lazar Miljenovic
2018-05-01 15:12   ` John MacFarlane
     [not found]     ` <m2r2mv76ln.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2018-05-01 15:53       ` Paul
     [not found]         ` <8bd93e89-5f06-4c39-9e68-1191cbe6df60-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-05-01 17:42           ` John MacFarlane [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yh480kpo2f1dd7.fsf@johnmacfarlane.net \
    --to=jgm-tvlzxgkolnx2fbvcvol8/a@public.gmane.org \
    --cc=freack1208-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).