From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/20148 Path: news.gmane.org!.POSTED!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: How do I use media bags? Date: Tue, 01 May 2018 10:42:44 -0700 Message-ID: References: <9bd0cbe0-31dd-45bd-be19-6d4fcc49bbec@googlegroups.com> <8bd93e89-5f06-4c39-9e68-1191cbe6df60@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1525196451 8721 195.159.176.226 (1 May 2018 17:40:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 1 May 2018 17:40:51 +0000 (UTC) To: Paul , pandoc-discuss Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBIOOULLQKGQEFORKK3Q-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue May 01 19:40:46 2018 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-ua0-f188.google.com ([209.85.217.188]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fDZGg-00029Y-MI for gtp-pandoc-discuss@m.gmane.org; Tue, 01 May 2018 19:40:46 +0200 Original-Received: by mail-ua0-f188.google.com with SMTP id x24sf8554239ual.21 for ; Tue, 01 May 2018 10:42:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1525196577; cv=pass; d=google.com; s=arc-20160816; b=NmKoF3Mom9k7GviXpyufi5MaNZAoH9eRA4h0ipinpomvn3dh+v/mMONWn7YjxlH3+5 tCsmQ3TSJ/KgNqBGUE6Sh7RCZ/JigAhoxXa0UhaaM11PNyMLXs/HfKo1L8jFSP7vIsBa aP1OAcTsACDzp8WAHee8k5skfmbThHJXVVLZiEmZTzCd0C/RkJ90+zU/bhc0vhcTEi14 KGHoWnl4KGGSAAscSSceGVP6rllncW2OmVcR6xxXNqYL123iyZphyFdam/Jn6c3unGYK QotVi9kFJnUZTC/Q3BgzuRcKzWc1bP5OhUvm/r15/yVfxzYVTJfSGMeh1gl1JInHhmuw kyXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:mime-version:message-id :date:references:in-reply-to:subject:to:from :arc-authentication-results:arc-message-signature:sender :dkim-signature:arc-authentication-results; bh=vCuDYC+x13BLTnZ89PYQBt6PuFDSJd1Zip2hdfoz3eg=; b=JjCwvgbMMjvLbKuhzxq9H+JlAewlhapwDAv0yGu6/GY1d/l9rWN6onbGiilZlxtDcY t7MuYIEnTd3MJES9N7GAyp35YfkvbUUqGy8uXcDty655019OzMg9Ms6P9ejgjYWStdgD UK0dFYl++F1KqXSCJpF3gLE42Yj8AsUk+PXJPHSCA4+u3nBYBaPRIuNGbr4Y0mbZYpV/ WkYRZVPZ00NNFZdca1gKRG87v0s5dAP5SNMkZ7ruvgJC6LY/pm+QnpH4m0QXHi8QgBCY Ckj+l9dSEs6b78vGx73cQaniZzaHj8kFjquKE70XSUSVwe/HOh1tmS34md9RBCj2tAqX Vefg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=ChA6wZ99; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c00::231 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:subject:in-reply-to:references:date:message-id :mime-version:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=vCuDYC+x13BLTnZ89PYQBt6PuFDSJd1Zip2hdfoz3eg=; b=Auc2rM6IC246lNYcZiWkzcSEoKV8O/jMRPE1mjqApm8Iy9tqBJqlzmFkDKokGM8Fdv FQXAGuEFo9STh125TcvOfmCS6+Jpd9hH0Lhu/7MrtZTlOPnjtGAGajsh3OXqDQ6TEN/z A4pfiBLR4Mt5vYqdiUg0YfW06+bfRXfTTZjjkl1xKE41zpwNew2DMzcxMg1/B1i+P50e 1VElaEZRGGeMt6pwedFgRdAD2STJOZAX2+Y4eC3IjkOXlsSs+HzZHH+l6C334GvTrSao /Fq1RS6ceezSwptcrylp276n3uznA21BThMYJV6AkY8xCPz9L6H+rthtEmiUV7UY9lme QR0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:subject:in-reply-to:references :date:message-id:mime-version:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=vCuDYC+x13BLTnZ89PYQBt6PuFDSJd1Zip2hdfoz3eg=; b=c9vZ8+JKBkFtKk1+dnk861Gfbmi8pnXnUYo3KNjnOC959e056/QbWnIyJ2uC34ksYG RIdrk//8bF6XwD4gc0zZiRx7fCX14KgqR4FoxdcKVMoahLcwxOJ3XxskgP3QCKqEt0EG 9ThMxUBzU62LyFfz+lbg+MKDGfeUwdFy3uM0uPmO/J+wkCFP6OpVAav3sb16674LSJ/H 5tu78n2jV0KsSLb0bfPqVY3iUAm8Bm4QWSoYgc7SMPsK5SRyDcK0LKVgKz65x+0zOXzi So0XrdaUrxaQjeLceRgaE6X5jM2Zn6FlmbaikIDehV2DiOesXbo3RtM9DJWK9OHnJ8Co zsmA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ALQs6tCnSewDiB63swR/oRsXpuB6vOYtw3oLQd9cHyGb2JgflFavvPVe ORLt/NE7L/qshy9wFn7WwSQ= X-Google-Smtp-Source: AB8JxZqgzorymL14svr45fNUleO1mZ7+2DNskK3Gis/0aWHHReSaY3XUKrGAFoFV1/vHU4DjLfI/GA== X-Received: by 2002:a1f:c102:: with SMTP id r2-v6mr2506124vkf.11.1525196577586; Tue, 01 May 2018 10:42:57 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.55.164.207 with SMTP id n198ls4135736qke.2.gmail; Tue, 01 May 2018 10:42:56 -0700 (PDT) X-Received: by 10.55.100.207 with SMTP id y198mr9943897qkb.40.1525196576768; Tue, 01 May 2018 10:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525196576; cv=none; d=google.com; s=arc-20160816; b=KjcJy1ONwHTszOHe3YWI7nWNT5idwJDaRAG3/hgK3mcF3/1S5yNHIVQHOFNxkEozpz pKCeXBp8m/CEDeCW/LCDFBVTARakzM8M2vFNrgslWG8ang5SMzt8PZfLCyVhrZpj9Dlf fNN6PqL4ldwMZFXSPnN1ki0w1AdC5Mm68PtbVIcE5apcQnAYgMbfdCgmG4wpgFoow5US QBLWGdodngYlHJXOgJzIxHMQFIxDu1BaPTM6PlOXYGohl07+7uI6A04k8f3gSCWw1dyr 3uq2BoTHJQSCr1USWnmA7/NDFIhsKoXsHA+iqJCTfNQwCJRot47NIlVyP34y5Ypr109u 7EcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :dkim-signature:arc-authentication-results; bh=klKeXzhKdLstzMA1FShVOX5I4O3tdSZqS/S2hNSboXE=; b=c043I0MzoWjwwcLqDgHYt0QEk0DahYUN2fyrZH8VSBMeYBE5+ZhiBPVfh0pbYMLZLw TqQyufEyN01uaN/UqzTm8EaJgZOkGdfc4eMrjXw6maWy8fiNt/xniPTlkscEj3yHDU2U Azw7V/9BeMlA9Ei9MgmcI1RKdxv1JVFcL3kFvi7MP/J8XJazU2gW5wzY/X9mujLqSmEX ci1hbbNv+6JhSIplcd8xM6a3tM7wz4bWGjyOEb/me84XgL9fppwCBurJpNiaeMuaYlB/ o/33IYethv8O70ueD8Ds/wZPCOQvmUR3YLsq9OzQLIwAK6BOZ5DOPebtY34wBxQCwNj1 pgNw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=ChA6wZ99; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c00::231 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pf0-x231.google.com (mail-pf0-x231.google.com. [2607:f8b0:400e:c00::231]) by gmr-mx.google.com with ESMTPS id d8-v6si495350qtm.3.2018.05.01.10.42.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 May 2018 10:42:56 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c00::231 as permitted sender) client-ip=2607:f8b0:400e:c00::231; Original-Received: by mail-pf0-x231.google.com with SMTP id o76so9584950pfi.5 for ; Tue, 01 May 2018 10:42:56 -0700 (PDT) X-Received: by 2002:a17:902:9303:: with SMTP id bc3-v6mr16967874plb.18.1525196576297; Tue, 01 May 2018 10:42:56 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id k83sm27822190pfg.153.2018.05.01.10.42.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 May 2018 10:42:55 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id 4C6A2A15F; Tue, 1 May 2018 13:42:44 -0400 (EDT) In-Reply-To: <8bd93e89-5f06-4c39-9e68-1191cbe6df60-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=ChA6wZ99; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c00::231 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Spam-Checked-In-Group: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:20148 Archived-At: Paul 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.