From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/23088 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Sal Migondis Newsgroups: gmane.text.pandoc Subject: Re: pandoc markdown to epub conversion - customize EPUB/text/cover.xhtml Date: Fri, 5 Jul 2019 15:46:34 -0700 (PDT) Message-ID: <0da36f70-8fc2-4571-abc7-69fe3a24ee35@googlegroups.com> References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1364_1950158984.1562366794627" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="87240"; mail-complaints-to="usenet@blaine.gmane.org" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCWO5EHYUULBBS5G77UAKGQEJVBGIXQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Jul 06 00:46:38 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-oi1-f187.google.com ([209.85.167.187]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1hjWyT-000MZY-Pu for gtp-pandoc-discuss@m.gmane.org; Sat, 06 Jul 2019 00:46:38 +0200 Original-Received: by mail-oi1-f187.google.com with SMTP id d204sf4465773oib.9 for ; Fri, 05 Jul 2019 15:46:37 -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=sllbCywch0UwYjDgkiILTDrez037Gholb1B9d9xgFdU=; b=fGLMN+Phb+LclWNTDV4Dl8evY9+BL+4dXA9aR3rHnDILR/ZTDZH8UFx+iNufcXYgwi YyxKSwDjwznfsL5D2tI/p7pM+72PJYnxL3MpnscyPdAM5LLNA7r2nJEjAEynIb+URd0s fkB9WA8XSA3nrsvnHAH5jjgXAJujyBgI54HojxibwwLWFv0k9CPXhf6yWumv9insg6KQ Sb/AYR0A2FtyLTvWlVfUmRx54M1mNQx/+jTJLpur77vtjPmCsbwc+BYfsWZaimHoS1dZ ZvZRh07U9bk3+Ic6bO48sU47UpFEohE9nSW0cpzZWwYU0/8qlSqWuJ9UccBY2nVtXf0F qWjQ== 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=sllbCywch0UwYjDgkiILTDrez037Gholb1B9d9xgFdU=; b=tij1/KxAmebdbrAJHN4ijgrsfs0bLdRmzyX1ktAn2HgNwNg2w8oUU4lVzZCj8N19Sq yJBIg/fFZCSLwOKiPm+GkHpbDy72mHw/Y2FFRWLoCfS4VN+01g6+LCDAT/UEpl2K4qnv xQEYVxFycIxDLlprR8FpcHjPYYPx/0dhWtl316oji506MHTXR+1LkOz9AJNJBjjLRp5g XOqYWTRHo+iWHN8Tr0Wv8RyaLQIyZtmCOD0PvX5lDA7jT2Oe8VxRyMM8imgyGWUegiRA VMp+WYev3xEyUufyn4G46kqZM8I/cmO9+ao6eud0W1SLveJnhwd1yz3E4jIvgjIqg5K3 NECw== 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=sllbCywch0UwYjDgkiILTDrez037Gholb1B9d9xgFdU=; b=rShlJChztc9Oqay/jFxdUY7KuAvavt9zL98eM4aq91+dL0CDECbh65NEOGNRzRwKgR VQuVzSNZ+yt3FjXpNE9a5Q1Ghsr4gIYJ0Z+673Ghv9TY9foJNGIBWKYqOGG5BJ+Bz8Er GWhgkVsPv9L7q9LJuLUlTTeIAAhPjGBWLRvx45KUVkXfirdMSZ7oAx1P/69CT7G0/J5c 1bXSdrSnlTADD3CthkPKL7wSCokBcY0WGPeiT9YzHYiXtIleV/lQW0DU5MbPDcfY7PLl bVeaeJ2SeGUkO7DcYdwopqbTUNXSP+25SvPEXRLz6KEkCvCn2excAyPqVwuVcby6dqGr z0nQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APjAAAXHOjQ2kxXS6TnprWgMtLYh0gY3OcoJWfoTvQt5llr+hIKWaD7Z dHs/qgBeVwGxL4aXpCU1rTs= X-Google-Smtp-Source: APXvYqzYJ6dME+SZkPhsfTXhcMnnofIVLYb+sC4J7cGro6a4xoYEJdnW56fRwrO7u1rE3UwGyDnDhQ== X-Received: by 2002:a9d:201:: with SMTP id 1mr4431101otb.279.1562366796463; Fri, 05 Jul 2019 15:46:36 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a9d:3e45:: with SMTP id h5ls110982otg.11.gmail; Fri, 05 Jul 2019 15:46:35 -0700 (PDT) X-Received: by 2002:a9d:7f0f:: with SMTP id j15mr4926565otq.156.1562366795259; Fri, 05 Jul 2019 15:46:35 -0700 (PDT) In-Reply-To: X-Original-Sender: salmig99-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-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:23088 Archived-At: ------=_Part_1364_1950158984.1562366794627 Content-Type: multipart/alternative; boundary="----=_Part_1365_600033809.1562366794628" ------=_Part_1365_600033809.1562366794628 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks.=20 I gave it a shot and gave up after another an hour of trial and error. What= =20 language do the pandoc templates use? is it syntax that's pandoc-specific= =20 or a language whose grammar is documented some place or other? Anyway I have given up on this and as a work-around I put together a shell= =20 script that: 1. runs pandoc to create the epub 2. unzips the epub 3. runs some standard *nix tools to fix the cover.xhtml file (head, cat,=20 sed=E2=80=A6) and add "properties=3Dsvg" to its reference in the con= tent.opf=20 "manifest" 4. zips back the epub 5. runs epubcheck to verify the resulting epub's conformity. qwick and dirty... not flexible.. works for me=E2=80=A6 In any case, since programs that specialize in epub editing/handling such= =20 as sigil or calibre appear to use this svg wrapper strategy in order to=20 ensure that the cover image is scaled to cover the entire display area of= =20 the e-reader's screen, my feeling about this is that when the=20 --epub-cover-image option is used=E2=80=A6 perhaps pandoc should do likewis= e and=20 generate this type of code *BY DEFAULT*... rather than via a custom=20 template...?=20 Thanks, SM On Wednesday, July 3, 2019 at 12:24:42 PM UTC-4, Sal Migondis wrote: > > Is there any way I can customize the generated EPUB/text/cover.xhtml file= =20 > created by pandoc? > > Basically I would need to replace the default: > >
>> 3D"cover >>
>> >> > By something like this: > >
>> > http://www.w3.org/1999/xlink" version=3D"1.1" width=3D"100%" height=3D"1= 00%"=20 >> viewBox=3D"0 0 900 1200" preserveAspectRatio=3D"none"> >> >> >>
>> >> > The idea is to wrap the cover image in an tag so that it=20 > scales to the dimensions of the e-reader. > > Note that 900x1200 just happens to be the dimensions of the default cover= s=20 > I generate on my system. > > I am having a problem where my covers are not correctly displayed on the= =20 > e-reader I use (ancient Kobo glo' with 758x1024 screen).=20 > > Thanks, > > SM > --=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 e= mail 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/0da36f70-8fc2-4571-abc7-69fe3a24ee35%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_1365_600033809.1562366794628 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks.

I gave it a sho= t and gave up after another an hour of trial and error. What language do th= e pandoc templates use? is it syntax that's pandoc-specific or a langua= ge whose grammar is documented some place or other?

Anyway I have given up on this and as a work-around I put together a shel= l script that:

1. runs pandoc to create the epub
2. unzips the epub
3. runs some standard *nix tools to f= ix the cover.xhtml file (head, cat, sed=E2=80=A6) and add "properties= =3Dsvg" to its <item> reference in the content.opf "manifes= t"
4. zips back the epub
5. runs epubcheck= to verify the resulting epub's conformity.

qw= ick and dirty... not flexible.. works for me=E2=80=A6

<= div>In any case, since programs that specialize in epub editing/handling su= ch as sigil or calibre appear to use this svg wrapper strategy in order to = ensure that the cover image is scaled to cover the entire display area of t= he e-reader's screen, my feeling about this is that when the --epub-cov= er-image option is used=E2=80=A6 perhaps pandoc should do likewise and gene= rate this type of code BY DEFAULT... rather than via a custom templa= te...?

Thanks,

SM

On Wednesday, July 3, 2019 at 12:24:42 PM UTC-4, Sal Migondis wr= ote:
Is t= here any way I can customize the generated EPUB/text/cover.xhtml file creat= ed by pandoc?

Basically I would need to replace th= e default:

<div id=3D"cover-image">
<img src=3D"= ../media/cover.png" alt=3D"cover image" />
</div>= ;


By something like this:

<= ;div id=3D"cover-image">
<svg xmlns=3D"http://www.w3.= org/2000/svg" xmlns:xlink=3D"http://www.w3.org/= 1999/xlink" version=3D"1.1" width=3D"100%" hei= ght=3D"100%" viewBox=3D"0 0 900 1200" preserveAspectRat= io=3D"none">
<image width=3D"900" height=3D&qu= ot;1200" xlink:href=3D"../media/cover.png"/>
<= /svg>
</div>


The = idea is to wrap the cover image in an <svg> </svg> tag so that = it scales to the dimensions of the e-reader.

Note = that 900x1200 just happens to be the dimensions of the default covers I gen= erate on my system.

I am having a problem where my= covers are not correctly displayed on the e-reader I use (ancient Kobo glo= ' with 758x1024 screen).

Thanks,

SM

--
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/0da36f70-8fc2-4571-abc7-69fe3a24ee35%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_1365_600033809.1562366794628-- ------=_Part_1364_1950158984.1562366794627--