public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Setting the document language on the HTML tag in epub3
@ 2019-10-29 14:40 Patrick Kenny
       [not found] ` <c500692e-7472-40fa-991e-378b7ab173d5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Patrick Kenny @ 2019-10-29 14:40 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 952 bytes --]

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="http://www.w3.org/1999/xhtml" xmlns:epub=
"http://www.idpf.org/2007/ops"$if(lang)$ xml:lang="$lang$"$endif$>

In my YAML metadata block, I have this:

language: ja

This sets the language in content.opf:

    <dc:language>ja</dc:language>

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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.

[-- Attachment #1.2: Type: text/html, Size: 4486 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Setting the document language on the HTML tag in epub3
       [not found] ` <c500692e-7472-40fa-991e-378b7ab173d5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-10-29 16:41   ` BP Jonsson
       [not found]     ` <CAFC_yuTob=pKyjGrQ3tT8SNp+o7E2hbpz3MZRqy_52=mfy5wJw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: BP Jonsson @ 2019-10-29 16:41 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 2021 bytes --]

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 <ptmkenny-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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="http://www.w3.org/1999/xhtml" xmlns:epub="
> http://www.idpf.org/2007/ops"$if(lang)$ xml:lang="$lang$"$endif$>
>
> In my YAML metadata block, I have this:
>
> language: ja
>
> This sets the language in content.opf:
>
>     <dc:language>ja</dc:language>
>
> 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-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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/CAFC_yuTob%3DpKyjGrQ3tT8SNp%2Bo7E2hbpz3MZRqy_52%3Dmfy5wJw%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 4879 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Setting the document language on the HTML tag in epub3
       [not found]     ` <CAFC_yuTob=pKyjGrQ3tT8SNp+o7E2hbpz3MZRqy_52=mfy5wJw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2019-10-30  0:39       ` Patrick Kenny
       [not found]         ` <92867006-1219-4139-9aff-1bc7345c09c5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Patrick Kenny @ 2019-10-30  0:39 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2397 bytes --]

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 <ptmk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <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="http://www.w3.org/1999/xhtml" xmlns:epub="
>> http://www.idpf.org/2007/ops"$if(lang)$ xml:lang="$lang$"$endif$>
>>
>> In my YAML metadata block, I have this:
>>
>> language: ja
>>
>> This sets the language in content.opf:
>>
>>     <dc:language>ja</dc:language>
>>
>> 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 <javascript:>.
>> 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/92867006-1219-4139-9aff-1bc7345c09c5%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 7944 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Setting the document language on the HTML tag in epub3
       [not found]         ` <92867006-1219-4139-9aff-1bc7345c09c5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-10-30 14:00           ` BP Jonsson
       [not found]             ` <CAFC_yuShZKiXOcyR2A3QPO6R=0s2m5SkbYKDwm=DP+Y8pWRwvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2019-10-30 15:13           ` Benct Philip Jonsson
  1 sibling, 1 reply; 10+ messages in thread
From: BP Jonsson @ 2019-10-30 14:00 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 3590 bytes --]

I have no idea I'm afraid.

What operating system are you on, and if it is Windows are you willing to
install perl? If you already have perl installed (you do if you are on
Linux or MacOS) or are willing to install it it will be fairly easy for me
to write a script which inserts the lang attribute everywhere if needed.
(It can certainly be done in Python too, but I'm not familiar with the
Python libraries for modifying HTML or accessing compressed files.)

Den ons 30 okt. 2019 01:39Patrick Kenny <ptmkenny-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

> 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 <ptmk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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="http://www.w3.org/1999/xhtml" xmlns:epub="
>>> http://www.idpf.org/2007/ops"$if(lang)$ xml:lang="$lang$"$endif$>
>>>
>>> In my YAML metadata block, I have this:
>>>
>>> language: ja
>>>
>>> This sets the language in content.opf:
>>>
>>>     <dc:language>ja</dc:language>
>>>
>>> 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-...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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/92867006-1219-4139-9aff-1bc7345c09c5%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/92867006-1219-4139-9aff-1bc7345c09c5%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/CAFC_yuShZKiXOcyR2A3QPO6R%3D0s2m5SkbYKDwm%3DDP%2BY8pWRwvw%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 7716 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Setting the document language on the HTML tag in epub3
       [not found]             ` <CAFC_yuShZKiXOcyR2A3QPO6R=0s2m5SkbYKDwm=DP+Y8pWRwvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2019-10-30 14:15               ` Daniel Staal
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Staal @ 2019-10-30 14:15 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

On 10/30/19 10:00 AM, BP Jonsson wrote:
> If you already have perl installed (you do if you are on Linux or MacOS)

Just a quick side-note: That's not necessarily true anymore.  Apple 
dropped Perl as a standard tool in 10.15.  (Along with Python, Ruby, 
etc.)  If you need it, you'll have to install it yourself.  (An app can 
also bundle their own version, of course.)

Daniel T. Staal

-- 
---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Setting the document language on the HTML tag in epub3
       [not found]         ` <92867006-1219-4139-9aff-1bc7345c09c5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2019-10-30 14:00           ` BP Jonsson
@ 2019-10-30 15:13           ` Benct Philip Jonsson
       [not found]             ` <bcba4331-6848-78df-39b4-66027098c757-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  1 sibling, 1 reply; 10+ messages in thread
From: Benct Philip Jonsson @ 2019-10-30 15:13 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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 <ptmk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <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="http://www.w3.org/1999/xhtml" xmlns:epub="
>>> http://www.idpf.org/2007/ops"$if(lang)$ xml:lang="$lang$"$endif$>
>>>
>>> In my YAML metadata block, I have this:
>>>
>>> language: ja
>>>
>>> This sets the language in content.opf:
>>>
>>>      <dc:language>ja</dc:language>
>>>
>>> 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 <javascript:>.
>>> 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>
>>> .
>>>
>>
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Setting the document language on the HTML tag in epub3
       [not found]             ` <bcba4331-6848-78df-39b4-66027098c757-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2019-10-30 18:12               ` Patrick Kenny
       [not found]                 ` <b0afa24e-6be4-47a0-af2a-d36eeee469af-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Patrick Kenny @ 2019-10-30 18:12 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 4783 bytes --]

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="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub=
"http://www.idpf.org/2007/ops"$if(lang)$ xml:lang="$lang$"$endif$>
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="pandoc" />
  <title>$pagetitle$</title>

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 <ptmk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org 
> <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="http://www.w3.org/1999/xhtml" xmlns:epub=" 
> >>> http://www.idpf.org/2007/ops"$if(lang)$ xml:lang="$lang$"$endif$> 
> >>> 
> >>> In my YAML metadata block, I have this: 
> >>> 
> >>> language: ja 
> >>> 
> >>> This sets the language in content.opf: 
> >>> 
> >>>      <dc:language>ja</dc:language> 
> >>> 
> >>> 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 <javascript:>. 
> >>> 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.

[-- Attachment #1.2: Type: text/html, Size: 19373 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Setting the document language on the HTML tag in epub3
       [not found]                 ` <b0afa24e-6be4-47a0-af2a-d36eeee469af-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-10-30 20:21                   ` BPJ
  2019-11-03 22:59                   ` John MacFarlane
  2019-11-03 23:11                   ` John MacFarlane
  2 siblings, 0 replies; 10+ messages in thread
From: BPJ @ 2019-10-30 20:21 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 5742 bytes --]

That's really strange since it works for me! What happens if you use -V
lang=ja on the command line?

I hope any of the developers has a clue what is going on, because I
haven't. Sorry!


Den ons 30 okt. 2019 19:13Patrick Kenny <ptmkenny-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

> 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="1.0" encoding="UTF-8"?>
> <!DOCTYPE html>
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="
> http://www.idpf.org/2007/ops"$if(lang)$ xml:lang="$lang$"$endif$>
> <head>
>   <meta charset="utf-8" />
>   <meta name="generator" content="pandoc" />
>   <title>$pagetitle$</title>
>
> 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 <ptmk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>> <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="http://www.w3.org/1999/xhtml" xmlns:epub="
>> >>> http://www.idpf.org/2007/ops"$if(lang)$ xml:lang="$lang$"$endif$>
>> >>>
>> >>> In my YAML metadata block, I have this:
>> >>>
>> >>> language: ja
>> >>>
>> >>> This sets the language in content.opf:
>> >>>
>> >>>      <dc:language>ja</dc:language>
>> >>>
>> >>> 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 <javascript:>.
>> >>> 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
> <https://groups.google.com/d/msgid/pandoc-discuss/b0afa24e-6be4-47a0-af2a-d36eeee469af%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/CADAJKhBQcOf8L00adQhWSd6PH8iF9TD7gbzNB0sJCnksN8_5pg%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 14455 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Setting the document language on the HTML tag in epub3
       [not found]                 ` <b0afa24e-6be4-47a0-af2a-d36eeee469af-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2019-10-30 20:21                   ` BPJ
@ 2019-11-03 22:59                   ` John MacFarlane
  2019-11-03 23:11                   ` John MacFarlane
  2 siblings, 0 replies; 10+ messages in thread
From: John MacFarlane @ 2019-11-03 22:59 UTC (permalink / raw)
  To: Patrick Kenny, pandoc-discuss


I can reproduce this.  Let me look into it.

Patrick Kenny <ptmkenny-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> 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="1.0" encoding="UTF-8"?>
> <!DOCTYPE html>
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub=
> "http://www.idpf.org/2007/ops"$if(lang)$ xml:lang="$lang$"$endif$>
> <head>
>   <meta charset="utf-8" />
>   <meta name="generator" content="pandoc" />
>   <title>$pagetitle$</title>
>
> 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 <ptmk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org 
>> <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="http://www.w3.org/1999/xhtml" xmlns:epub=" 
>> >>> http://www.idpf.org/2007/ops"$if(lang)$ xml:lang="$lang$"$endif$> 
>> >>> 
>> >>> In my YAML metadata block, I have this: 
>> >>> 
>> >>> language: ja 
>> >>> 
>> >>> This sets the language in content.opf: 
>> >>> 
>> >>>      <dc:language>ja</dc:language> 
>> >>> 
>> >>> 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 <javascript:>. 
>> >>> 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.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Setting the document language on the HTML tag in epub3
       [not found]                 ` <b0afa24e-6be4-47a0-af2a-d36eeee469af-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2019-10-30 20:21                   ` BPJ
  2019-11-03 22:59                   ` John MacFarlane
@ 2019-11-03 23:11                   ` John MacFarlane
  2 siblings, 0 replies; 10+ messages in thread
From: John MacFarlane @ 2019-11-03 23:11 UTC (permalink / raw)
  To: Patrick Kenny, pandoc-discuss


I just pushed a fix -- thanks for reporting!


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-11-03 23:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 14:40 Setting the document language on the HTML tag in epub3 Patrick Kenny
     [not found] ` <c500692e-7472-40fa-991e-378b7ab173d5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-10-29 16:41   ` BP Jonsson
     [not found]     ` <CAFC_yuTob=pKyjGrQ3tT8SNp+o7E2hbpz3MZRqy_52=mfy5wJw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-10-30  0:39       ` Patrick Kenny
     [not found]         ` <92867006-1219-4139-9aff-1bc7345c09c5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-10-30 14:00           ` BP Jonsson
     [not found]             ` <CAFC_yuShZKiXOcyR2A3QPO6R=0s2m5SkbYKDwm=DP+Y8pWRwvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-10-30 14:15               ` Daniel Staal
2019-10-30 15:13           ` Benct Philip Jonsson
     [not found]             ` <bcba4331-6848-78df-39b4-66027098c757-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-10-30 18:12               ` Patrick Kenny
     [not found]                 ` <b0afa24e-6be4-47a0-af2a-d36eeee469af-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-10-30 20:21                   ` BPJ
2019-11-03 22:59                   ` John MacFarlane
2019-11-03 23:11                   ` John MacFarlane

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).