From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/23730 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Patrick Kenny Newsgroups: gmane.text.pandoc Subject: Re: Setting the document language on the HTML tag in epub3 Date: Wed, 30 Oct 2019 11:12:24 -0700 (PDT) Message-ID: References: <92867006-1219-4139-9aff-1bc7345c09c5@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2409_1484488505.1572459144711" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="18379"; mail-complaints-to="usenet@blaine.gmane.org" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDLYD7NCUUKBBCVF47WQKGQE2QATBCQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Oct 30 19:12:30 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 1iPsSK-0004bH-A7 for gtp-pandoc-discuss@m.gmane.org; Wed, 30 Oct 2019 19:12:28 +0100 Original-Received: by mail-oi1-f187.google.com with SMTP id t84sf1664816oig.20 for ; Wed, 30 Oct 2019 11:12:28 -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=kf8SejtpCsna8E1c8vyVYayIoDHosMEgY7Zq39n++A0=; b=Kjrsg1yPNgmfC5PT0WJHRrCAR+fIOmLPoY3KnK/RjvMmAWGqY2FFkVhLTTPoXUynjt LFqI5yHs5/rwHlNOE0ENf2A0LtTY4KSkKIq/CBmBg+dRlIAkL1pLO2WVL/oMXz/jCPMX RGlmsc38qcods3UJ4CEdj06u6Jt9Uwei6O8nLX92FXudhWOsp9S1q/nWYFtX0xccvGR/ t0MdI4PckJ1lPUUU/4IUaLhYYKCWOdw8S7YaAJFLmZsiABM6a8PmkBwlgOhk8DU+I+ZE fzL07qjf7r/QlxsOnO+pBizh64oFkX0cQy5G2/cFZqQfREiO/e83h3dk5iL6/T6xru4E dO1w== 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=kf8SejtpCsna8E1c8vyVYayIoDHosMEgY7Zq39n++A0=; b=dt0i8xAfq/bB79FwOoCOieL4XL4ka8u81COcWYSA6yKQpwB010eoCMOVjr/NIrVyic OsyAj1a2IWRrjeF1+1Y6keKYVm11JDosapc+nfBbH5IpVSGsGHNDZs0NYMfduJHlPuYf zcD44eMEnwlLIqGiQvivAMVhNhPUqzclrxFezxZ4r2TPJK3lm83HTRzM6f/KKaFH25mh be9GWfL2cK4PjoHKlzECWkrB6FZYHMLpZS3+UOryZXvE12HYg6MptuQmokx31UQW++DW F0Eg1kUsPNLGYY0CJH2b08JehADVqp6WcjgKbCOsn3gMh+lHursPKepj8FUv40Pdcemy IGVQ== 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=kf8SejtpCsna8E1c8vyVYayIoDHosMEgY7Zq39n++A0=; b=gOxGfBZfJX/eMJZB0lflpjpymO3/q/41WbhuulGTOQSc3esiJ6PvABFZ50Zr3X4FBM nEdTChdrwebHvQQdOuw5h/N27er/rmieVuwSWW6QJWRLR2M+uGnfYC4amq+OIqtIPHLt Tgi4P9o+syY96ascj55Ss1I1HYV3NM3TrP9WI2x6maORR/hSY0IrEcXpQZRyiekaFKd6 uCf/b6F1THq577C2ESQIsRCzzXWF6otXgPBiN2C56bvGXU1hjgUA0B26sqwO0wMCU4X2 wqwY7YnMKuqo2USK+Xr8+MebfsfV2uHMohpQoQAM/ctb9mso6b4mGAfoG/MTHJO/jI4x cqdg== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: APjAAAXn9GdHWSRBtYUYYlFRXQPCu7KmoDaFxEAxpy+EhiYTZdt5Gqgc SHtuDpnZ2J2pFoRTVOREoX0= X-Google-Smtp-Source: APXvYqxI+pVIKi83blZtRmvdbYdh7NwawsOHrpvKU7HzlDtBSIw5JYlD6s4SUfNdFILxwaU+SLR3oA== X-Received: by 2002:aca:7282:: with SMTP id p124mr426647oic.95.1572459146949; Wed, 30 Oct 2019 11:12:26 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6808:90b:: with SMTP id w11ls534497oih.13.gmail; Wed, 30 Oct 2019 11:12:26 -0700 (PDT) X-Received: by 2002:a05:6808:9bc:: with SMTP id e28mr415014oig.137.1572459145605; Wed, 30 Oct 2019 11:12:25 -0700 (PDT) In-Reply-To: X-Original-Sender: ptmkenny-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:23730 Archived-At: ------=_Part_2409_1484488505.1572459144711 Content-Type: multipart/alternative; boundary="----=_Part_2410_817835390.1572459144713" ------=_Part_2410_817835390.1572459144713 Content-Type: text/plain; charset="UTF-8" Ok, here's some more information. I'm running Pandoc 2.7.3 on macOS 10.14.6. My custom template hasn't been modified in the header area: $pagetitle$ I have a file called book-variables.yaml that looks like this: --- lang: ja title: - type: main text: "Wow a book" creator: - role: author text: "Me" language: ja identifier: - scheme: DOI text: doi:10.234234.234/33 ibooks: version: 1.3.4 page-progression-direction: ltr --- And I am using the command: /usr/local/bin/pandoc mybook_epub_apple_4pandoc /Users/me/Library/ MobileDocuments/com~apple~CloudDocs/book-variables.yaml -o mybook.epub -- from=markdown-smart --to=epub-smart --toc --toc-depth=3 --epub- chapter-level=2 -M date=2019-10-31 --css epub.css --resource -path .:/Users/me/Library/MobileDocuments/com~apple~CloudDocs/audio --epub- cover-image=cover.jpg --template mytemplate.epub3 &> epub_apple_pandoc_errors.txt With this setup, cover.xhtml and title_page.xhtml have the language set on the HTML tag, but none of the chapter files do. (ch001.xhtml, etc.) On Thursday, October 31, 2019 at 12:14:13 AM UTC+9, BP wrote: > > I just tried to generate an epub (something I don't usually do) having > set the `lang` variable to `sv` and as far as I can see every .xhtml > file in the archive has an attribute `xml:lang="sv"`, and the default > templates for both epub3 and epub2 have an `$if(lang)$ > xml:lang="$lang$"$endif$` in the `html` tag. So one or both of the > following must be the case: > > - Your version of pandoc is outdated. > - You are using a custom template which lacks the `$if(lang)$ > xml:lang="$lang$"$endif$` in the `html` tag. > > I suggest upgrading pandoc and/or adding the needed bit to you template. > > > > On 2019-10-30 01:39, Patrick Kenny wrote: > > Thank you for the response. > > > > When I use > > > > lang:ja > > > > Then > > > > * cover.xhtml > > * title_page.xhtml > > > > get > > > > xml:lang="ja" > > > > as expected, but none of the chapter files do. (ch001.xhtml, etc.) Is > this > > the expected behavior? How can I also modify the chapter files? > > > > > > On Wednesday, October 30, 2019 at 1:42:15 AM UTC+9, BP Jonsson wrote: > >> > >> The metadata key is exactly like the placeholder in the template, no > more, > >> no less, i.e. `lang: ja`. This is true generally, and you can easily > define > >> your own variables in your own templates. That wouldn't work if Pandoc > >> meddled with the variable names so that the names used in metadata and > >> those used in templates were somehow different. > >> > >> > >> Den tis 29 okt. 2019 15:40Patrick Kenny > > >> skrev: > >> > >>> Going from markdown to epub3, how do I set the language on the HTML > tag > >>> in the epub? > >>> > >>> For epub3, the template looks like this: > >>> > >>> > >>> > >>> In my YAML metadata block, I have this: > >>> > >>> language: ja > >>> > >>> This sets the language in content.opf: > >>> > >>> ja > >>> > >>> But it doesn't set the language on the HTML tag. > >>> > >>> I also tried adding > >>> > >>> language: ja > >>> > >>> to the metadata, but this didn't change the value on the HTML tag, > either. > >>> > >>> -- > >>> 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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org . > >>> To view this discussion on the web visit > >>> > https://groups.google.com/d/msgid/pandoc-discuss/c500692e-7472-40fa-991e-378b7ab173d5%40googlegroups.com > >>> < > https://groups.google.com/d/msgid/pandoc-discuss/c500692e-7472-40fa-991e-378b7ab173d5%40googlegroups.com?utm_medium=email&utm_source=footer> > > >>> . > >>> > >> > > > > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/b0afa24e-6be4-47a0-af2a-d36eeee469af%40googlegroups.com. ------=_Part_2410_817835390.1572459144713 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ok, here's some more information. I'm running= Pandoc 2.7.3 on macOS 10.14.6.

My custom template= hasn't been modified in the header area:

<?= xml version=3D"1.0"<= span style=3D"color: #000;" class=3D"styled-by-prettify"> encoding=3D"UTF-8"?>
<!DOCTYPE html>=
<html xmlns=3D"http://www.w3.org/1999/xhtml" xmlns:epub=3D"http://www.idpf.org/2007/o= ps"$<= /span>if(lang)$ xml:lang=3D"$lang$"$endif$>
&l= t;head>=
=C2=A0
<meta = charset
=3D"utf-8"
/>
=C2=A0
<meta name=3D"generator" content=3D"pandoc" />
=C2=A0
<title>$pagetitle$</title>

I have a file called book-variables.yaml that looks like this:
=

---
lang: ja
title:
= - type: main
=C2=A0 text: "Wow a book"
creato= r:
- role: author
=C2=A0 text: "Me"
=
language: ja
identifier:
- scheme: DOI
=C2=A0 text: doi:10.234234.234/33
ibooks:
=C2=A0= version: 1.3.4
page-progression-direction: ltr
---
=

And I am using the command:

<= div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); bo= rder-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; ove= rflow-wrap: break-word;">
/usr/local/bin/pandoc mybook_epub_apple_4pandoc /Users/me/Library/MobileDocuments/= com~apple~CloudDocs/book-variables.yaml -o mybook.epub --from= =3Dmarkdow= n-<= span style=3D"color: #000;" class=3D"styled-by-prettify">smart --to=3Depub-smart =C2=A0 =C2=A0 =C2=A0 =C2=A0 --toc --toc-depth= =3D3 --epub-chapter-level=3D2 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 -M date=3D2019<= /span>-10-31 =C2=A0 =C2=A0 =C2=A0 =C2=A0 --css epub.css --resource-path = .:/Users/me/Library/MobileDocuments/com~apple~CloudD= ocs/audio =C2=A0--epub-cover-image=3Dcover.jp= g =C2=A0--= template mytemplate<= /span>.epub3 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 &> epub_apple_pandoc_errors.txt

With this setup, cover.x= html and title_page.xhtml have the language set on the HTML tag,=C2=A0 but = none of the chapter files do. (ch001.xhtml, etc.)=C2=A0



On Thursday, October 31, 2019 at 12:14:13 AM UTC+9, BP = wrote:
I just tried to generate= an epub (something I don't usually do) having=20
set the `lang` variable to `sv` and as far as I can see every .xhtml=20
file in the archive has an attribute `xml:lang=3D"sv"`, and t= he default=20
templates for both epub3 and epub2 have an `$if(lang)$=20
xml:lang=3D"$lang$"$endif$` in the `html` tag. =C2=A0So one o= r both of the=20
following must be the case:

- =C2=A0Your version of pandoc is outdated.
- =C2=A0You are using a custom template which lacks the `$if(lang)$=20
xml:lang=3D"$lang$"$endif$` in the `html` tag.

I suggest upgrading pandoc and/or adding the needed bit to you template= .



On 2019-10-30 01:39, Patrick Kenny wrote:
> Thank you for the response.
>=20
> When I use
> =C2=A0=20
> lang:ja
>=20
> Then
>=20
> * cover.xhtml
> * title_page.xhtml
>=20
> get
> =C2=A0=20
> =C2=A0 xml:lang=3D"ja"
>=20
> as expected, but none of the chapter files do. (ch001.xhtml, etc.)= =C2=A0Is this
> the expected behavior? =C2=A0How can I also modify the chapter fil= es?
>=20
>=20
> On Wednesday, October 30, 2019 at 1:42:15 AM UTC+9, BP Jonsson wro= te:
>>
>> The metadata key is exactly like the placeholder in the templa= te, no more,
>> no less, i.e. `lang: ja`. This is true generally, and you can = easily define
>> your own variables in your own templates. That wouldn't wo= rk if Pandoc
>> meddled with the variable names so that the names used in meta= data and
>> those used in templates were somehow different.
>>
>>
>> Den tis 29 okt. 2019 15:40Patrick Kenny <ptmk...@gmail.c= om <javascript:>>
>> skrev:
>>
>>> Going from markdown to epub3, how do I set the language on= the HTML tag
>>> in the epub?
>>>
>>> For epub3, the template looks like this:
>>>
>>> <html xmlns=3D"http://www.w3.org/1999/xhtml= " xmlns:epub=3D"
>>> http://www.idpf.org/2007/ops"$if(lang)$ xm= l:lang=3D"$lang$"$endif$>
>>>
>>> In my YAML metadata block, I have this:
>>>
>>> language: ja
>>>
>>> This sets the language in content.opf:
>>>
>>> =C2=A0 =C2=A0 =C2=A0<dc:language>ja</dc:language&= gt;
>>>
>>> But it doesn't set the language on the HTML tag.
>>>
>>> I also tried adding
>>>
>>> language: ja
>>>
>>> to the metadata, but this didn't change the value on t= he HTML tag, either.
>>>
>>> --=20
>>> You received this message because you are subscribed to th= e Google Groups
>>> "pandoc-discuss" group.
>>> To unsubscribe from this group and stop receiving emails f= rom it, send an
>>> email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript= :>.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/pandoc-di= scuss/c500692e-7472-40fa-991e-378b7ab173d5%40googlegroups.com
>>> <https://groups.google.com/d/msgid/pandoc-discuss/c500692e-= 7472-40fa-991e-378b7ab173d5%40googlegroups.com?utm_medium=3D= email&utm_source=3Dfooter>
>>> .
>>>
>>
>=20

--
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 view this discussion on the web visit https://groups.google.com/d/= msgid/pandoc-discuss/b0afa24e-6be4-47a0-af2a-d36eeee469af%40googlegroups.co= m.
------=_Part_2410_817835390.1572459144713-- ------=_Part_2409_1484488505.1572459144711--