From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/20145 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Newsgroups: gmane.text.pandoc Subject: Re: How do I use media bags? Date: Tue, 1 May 2018 08:53:47 -0700 (PDT) Message-ID: <8bd93e89-5f06-4c39-9e68-1191cbe6df60@googlegroups.com> References: <9bd0cbe0-31dd-45bd-be19-6d4fcc49bbec@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_28679_153197628.1525190027791" X-Trace: blaine.gmane.org 1525189903 25438 195.159.176.226 (1 May 2018 15:51:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 1 May 2018 15:51:43 +0000 (UTC) To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCF4ZCX7XUMRBDE3ULLQKGQEJJ37FMQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue May 01 17:51:39 2018 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-vk0-f64.google.com ([209.85.213.64]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fDXZ4-0006Vo-5r for gtp-pandoc-discuss@m.gmane.org; Tue, 01 May 2018 17:51:38 +0200 Original-Received: by mail-vk0-f64.google.com with SMTP id 79-v6sf10063333vky.13 for ; Tue, 01 May 2018 08:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=/fU4YBk88N3YQOTz1Oi+m95UY8NAhSFyHBzVFok6hv4=; b=Zy13ZS1XnucbknzwSrHuWCeeqIHvl7PaV5NfVLXCkAiMsvSAJgZVz6vp336rzvpDhX k10BVliFKOQaqHuIQQAmQGNjgZVa6H7nU5Fnyh1ogI0mb2Gy8cn/s4maa+CS2mF2qMFO 89F0SEgWEMuv1SH2t4+23uNiaOVieWR2RtUYi04eMD2UYMdt4zrjB86C9P1LYWvKFiLP kFpA+L9yp/ckK00ZrBLUu4/JynM6NUZBxG/CM/DbEi62APOaV7BiunZyUVYF7UdteLZZ zTEzeWDFt4XKK4IZoK9kevzOg5CxVBN7OQNeBgRj/SoimUQWdyKYEfbeNv1flYcACHpi L5yg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=/fU4YBk88N3YQOTz1Oi+m95UY8NAhSFyHBzVFok6hv4=; b=mEob2d/cZkWnwkeBeToLK050hndqMfEFKrlqlqvajfjPvfMTfXJfLbr8foGS9x3MrU rAoPo6JCXKvewbzzZwZxDcxDfl1FYGCYxXSiRocZGSaVBi7Ma06nP6ProMhUrqoZJn5j Ni9EGlCHuVjR5TdDYMt3g/Pf19iet0CiFtRgrUQfy2+SeqV6N8gnJfRcBvqC3dAWY6v9 uU7DAlfDy9fG5opQYHkuXuu1H84xZ2mABNVLoriZOcUT/R9kGstwmJ/hBbCwzxgFr4UB dwETaKe+TDCsMGKJn0KQaq3zMYpOySvA3fJfu6H3sLf7f1cYqTg+TmC5HIsOJn+PP/TT HvYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=/fU4YBk88N3YQOTz1Oi+m95UY8NAhSFyHBzVFok6hv4=; b=Qb4QrDBavGYVRnx3poEKOLbvDlfc9cTArZnqJk+PyaEAvH4iCeAQYzq9uW1ZQMabP/ 6RLMHrN0PZQnmQsYRVz5A5M33yZLKPSLjRN09oM0lQaZa6yD6kPYT/QuDdjWaQLuwH82 n5+x8dIOKlnbUwx08jmB7Ob1Kt066h4eTlEV4dMCURtf3QR7+9HVBU8jkR2bJWRCGfKM aLTNG+CpHhHjbfQLfY+y5Apfn98400FnoKGsGgeovoot2LnxJzWZblzRitwP5DHFCchp y6BKKxw9CZ2ZfUZ9szwEArjq+CIDsMcgBjnf4h9GWU3o8m0h94FpixI0HlhU09t4pvkH x8rw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ALQs6tCIFOab9vEXjCCd6mOULXKfo9ot3wm4SUrjqrrjDgRBdPP1/uzC ctsew8v0ogTkzSn3KknWOfo= X-Google-Smtp-Source: AB8JxZoHKAgPasAb6jDDbqTh7kaA2Rx/+G6DjJO0cwC4tZFj28NlAldomJTJgUarJT0PjFePThO6tQ== X-Received: by 2002:a1f:951:: with SMTP id 78-v6mr2260367vkj.0.1525190029174; Tue, 01 May 2018 08:53:49 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a1f:b204:: with SMTP id b4-v6ls6152833vkf.0.gmail; Tue, 01 May 2018 08:53:48 -0700 (PDT) X-Received: by 2002:a1f:aa8d:: with SMTP id t135-v6mr2468953vke.2.1525190028329; Tue, 01 May 2018 08:53:48 -0700 (PDT) In-Reply-To: X-Original-Sender: freack1208-Re5JQEeQqe8AvxtiuMwx3w@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:20145 Archived-At: ------=_Part_28679_153197628.1525190027791 Content-Type: multipart/alternative; boundary="----=_Part_28680_1142122387.1525190027791" ------=_Part_28680_1142122387.1525190027791 Content-Type: text/plain; charset="UTF-8" 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? My current code: https://gist.github.com/MagnificentPako/b72c3347b3e6bc2474c26ee91b8384ae Am Dienstag, 1. Mai 2018 17:11:25 UTC+2 schrieb John MacFarlane: > > > The more recent pandoc-types should eliminate the need for > the orphan Semigroup instance. > > You shouldn't need fillMediaBag if you're reading docx, because > the docx reader should populate the media bag automatically using > images from the docx container itself. > > However, there's an issue with the way your code is structured. > Each time you do runIO, it will reinitialize the mediabag, so > you'll lose information. What you should do is put the whole > conversion pipeline (reading docxs and writing epubs) under one runIO. > > Paul > writes: > > > Hello! > > > > Just tried to use the Haskell API side of Pandoc but I rand into lots of > > "could not fetch resource" warnings". Is there anything that would help > me > > extract the media from the downloaded .docx files and embed them in my > > epubs? > > The (I believe) relevant parts of my code are here: > > https://gist.github.com/MagnificentPako/22df4be40251a07a4f5d0dc4fafc5d46 > > > > (For some reason I had to re-implement Semigroup for both Pandoc and > Meta > > because my GHC would complain that they are missing it otherwise.) > > > > -- > > 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org . > > To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/9bd0cbe0-31dd-45bd-be19-6d4fcc49bbec%40googlegroups.com. > > > For more options, visit https://groups.google.com/d/optout. > -- 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/8bd93e89-5f06-4c39-9e68-1191cbe6df60%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_28680_1142122387.1525190027791 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 u= sing images where they shouldn't be (not like randomly adding images, b= ut using the wrong image). Are there collisions between the images? If so, = is that something one can fix?

My current code: https://gist.github.= com/MagnificentPako/b72c3347b3e6bc2474c26ee91b8384ae

Am Dienstag, 1.= Mai 2018 17:11:25 UTC+2 schrieb John MacFarlane:

The more recent pandoc-types should eliminate the need for
the orphan Semigroup instance.

You shouldn't need fillMediaBag if you're reading docx, because
the docx reader should populate the media bag automatically using
images from the docx container itself.

However, there's an issue with the way =C2=A0your code is structure= d.
Each time you =C2=A0do runIO, it will reinitialize the mediabag, so
you'll lose information. =C2=A0What you should do is put the whole
conversion pipeline (reading docxs and writing epubs) under one runIO.

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

> Hello!
>
> Just tried to use the Haskell API side of Pandoc but I rand into l= ots of=20
> "could not fetch resource" warnings". Is there anyt= hing that would help me=20
> extract the media from the downloaded .docx files and embed them i= n my=20
> epubs?
> The (I believe) relevant parts of my code are here:=20
> https= ://gist.github.com/MagnificentPako/22df4be40251a07a4f5d0dc4fafc5d= 46
>
> (For some reason I had to re-implement Semigroup for both Pandoc a= nd Meta=20
> because my GHC would complain that they are missing it otherwise.)
>
> --=20
> 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-discus...@googlegroups.com.
> To post to this group, send email to pandoc-...@googlegroups.com.
> To view this discussion on the web visit
https://groups.= google.com/d/msgid/pandoc-discuss/9bd0cbe0-31dd-45bd-be19-6d4fcc4= 9bbec%40googlegroups.com.
> For more options, visit https://groups.go= ogle.com/d/optout.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/= msgid/pandoc-discuss/8bd93e89-5f06-4c39-9e68-1191cbe6df60%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_28680_1142122387.1525190027791-- ------=_Part_28679_153197628.1525190027791--