public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* chunkedhtml - metadata variable for template reset after first chunk
@ 2023-02-13 11:32 Martin Post
       [not found] ` <b8b475d4-9741-41b0-add8-8b057e6e867fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Post @ 2023-02-13 11:32 UTC (permalink / raw)
  To: pandoc-discuss


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

I’m running Pandoc from a shell script, with multiple passes. The HTML 
template I am using here is fairly complex and should be used both for html 
and chunkedhtml output.

In the template, I have placed a navigation in a conditional (simplified 
here):

$-- $if(document-type-chunked)$
<nav class="sitenav">
<a href="$next.url$">$next.title$</a>$ <a 
href="$previous.url$">$previous.title$</a>
</nav>
$-- $endif$

In the shell script, I set this meta variable (document-type-chunked):

pandoc --standalone $(basename $file) --to=chunkedhtml --metadata 
document-type-chunked=true --output=${outputname%.*}

The metadata variable is still true for the first page of the chunked 
output (index.html), but not for the remaining chunks, so they get no 
navigation.

Am I making a mistake?

I realize I could also put conditionals around each single navigation item 
($if(next.url)$), but it would be easier to build complex templates if I 
could pass a variable to the template.

Could this be resolved differently?

Thank you.

-- 
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/b8b475d4-9741-41b0-add8-8b057e6e867fn%40googlegroups.com.

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

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

* Re: chunkedhtml - metadata variable for template reset after first chunk
       [not found] ` <b8b475d4-9741-41b0-add8-8b057e6e867fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-02-13 11:53   ` 'William Lupton' via pandoc-discuss
       [not found]     ` <CAEe_xxhfNevy=fxs1yvLN3zxVm=Z8exGVyXL3s3yNMYm3cCT_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: 'William Lupton' via pandoc-discuss @ 2023-02-13 11:53 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

I haven't used chunked html, but did notice this in the manual. Not sure
whether this affects you here...


*The navigation links can be customized by adjusting the template. By
default, a table of contents is included only on the top page. To include
it on every page, set the toc variable manually.*

https://pandoc.org/MANUAL.html#chunked-html

On Mon, 13 Feb 2023 at 11:32, Martin Post <martinpostberlin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:

> I’m running Pandoc from a shell script, with multiple passes. The HTML
> template I am using here is fairly complex and should be used both for html
> and chunkedhtml output.
>
> In the template, I have placed a navigation in a conditional (simplified
> here):
>
> $-- $if(document-type-chunked)$
> <nav class="sitenav">
> <a href="$next.url$">$next.title$</a>$ <a
> href="$previous.url$">$previous.title$</a>
> </nav>
> $-- $endif$
>
> In the shell script, I set this meta variable (document-type-chunked):
>
> pandoc --standalone $(basename $file) --to=chunkedhtml --metadata
> document-type-chunked=true --output=${outputname%.*}
>
> The metadata variable is still true for the first page of the chunked
> output (index.html), but not for the remaining chunks, so they get no
> navigation.
>
> Am I making a mistake?
>
> I realize I could also put conditionals around each single navigation item
> ($if(next.url)$), but it would be easier to build complex templates if I
> could pass a variable to the template.
>
> Could this be resolved differently?
>
> Thank you.
>
> --
> 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/b8b475d4-9741-41b0-add8-8b057e6e867fn%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/b8b475d4-9741-41b0-add8-8b057e6e867fn%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/CAEe_xxhfNevy%3Dfxs1yvLN3zxVm%3DZ8exGVyXL3s3yNMYm3cCT_A%40mail.gmail.com.

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

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

* Re: chunkedhtml - metadata variable for template reset after first chunk
       [not found]     ` <CAEe_xxhfNevy=fxs1yvLN3zxVm=Z8exGVyXL3s3yNMYm3cCT_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2023-02-13 12:01       ` Martin Post
       [not found]         ` <b065b793-9825-41a8-89f0-a315f6d70e26n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Post @ 2023-02-13 12:01 UTC (permalink / raw)
  To: pandoc-discuss


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

No, the toc is different from the chunkedhtml nav links (top, next.url, 
previous.url). And these are available. It’s just that the metadata 
variable that I use to conditionally place the navigation section is lost 
with --to=chunkedhtml.

William Lupton schrieb am Montag, 13. Februar 2023 um 12:53:40 UTC+1:

> I haven't used chunked html, but did notice this in the manual. Not sure 
> whether this affects you here...
>
>
> *The navigation links can be customized by adjusting the template. By 
> default, a table of contents is included only on the top page. To include 
> it on every page, set the toc variable manually.*
>
> https://pandoc.org/MANUAL.html#chunked-html
>
> On Mon, 13 Feb 2023 at 11:32, Martin Post <martinpo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>> I’m running Pandoc from a shell script, with multiple passes. The HTML 
>> template I am using here is fairly complex and should be used both for html 
>> and chunkedhtml output.
>>
>> In the template, I have placed a navigation in a conditional (simplified 
>> here):
>>
>> $-- $if(document-type-chunked)$
>> <nav class="sitenav">
>> <a href="$next.url$">$next.title$</a>$ <a 
>> href="$previous.url$">$previous.title$</a>
>> </nav>
>> $-- $endif$
>>
>> In the shell script, I set this meta variable (document-type-chunked):
>>
>> pandoc --standalone $(basename $file) --to=chunkedhtml --metadata 
>> document-type-chunked=true --output=${outputname%.*}
>>
>> The metadata variable is still true for the first page of the chunked 
>> output (index.html), but not for the remaining chunks, so they get no 
>> navigation.
>>
>> Am I making a mistake?
>>
>> I realize I could also put conditionals around each single navigation 
>> item ($if(next.url)$), but it would be easier to build complex templates if 
>> I could pass a variable to the template.
>>
>> Could this be resolved differently?
>>
>> Thank you.
>>
>> -- 
>> 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/pandoc-discuss/b8b475d4-9741-41b0-add8-8b057e6e867fn%40googlegroups.com 
>> <https://groups.google.com/d/msgid/pandoc-discuss/b8b475d4-9741-41b0-add8-8b057e6e867fn%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/b065b793-9825-41a8-89f0-a315f6d70e26n%40googlegroups.com.

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

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

* Re: chunkedhtml - metadata variable for template reset after first chunk
       [not found]         ` <b065b793-9825-41a8-89f0-a315f6d70e26n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-02-13 13:44           ` Martin Post
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Post @ 2023-02-13 13:44 UTC (permalink / raw)
  To: pandoc-discuss


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

I just built a from scratch test. Unfortunately, it seems that with output 
to chunkedhtml, variables are only used on the first page and then lost, so 
it’s not possible to do conditionals or use metadata in a template. But I 
may be missing something, so I’m not reporting this as a bug yet.

I’m using this, with a simple template:

pandoc
--standalone
--from=markdown
--to=chunkedhtml
--toc
--split-level=2
--template=chunking_test_template.htm
--defaults=chunking_test_metadata.yml
--metadata metavar1fromcommandline="This is the value of 
metavar1fromcommandline"
chunking_test_source.md
--output=chunking_test_output_folder

As seen in the attached screenshot, the variables set (1) in the Markdown 
file, (2) the YAML defaults file and (3) on the command line are present on 
“index.html”, but not on the following pages.

[image: chunking_test_results.png]
Martin Post schrieb am Montag, 13. Februar 2023 um 13:01:25 UTC+1:

> No, the toc is different from the chunkedhtml nav links (top, next.url, 
> previous.url). And these are available. It’s just that the metadata 
> variable that I use to conditionally place the navigation section is lost 
> with --to=chunkedhtml.
>
> William Lupton schrieb am Montag, 13. Februar 2023 um 12:53:40 UTC+1:
>
>> I haven't used chunked html, but did notice this in the manual. Not sure 
>> whether this affects you here...
>>
>>
>> *The navigation links can be customized by adjusting the template. By 
>> default, a table of contents is included only on the top page. To include 
>> it on every page, set the toc variable manually.*
>>
>> https://pandoc.org/MANUAL.html#chunked-html
>>
>> On Mon, 13 Feb 2023 at 11:32, Martin Post <martinpo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>
>>> I’m running Pandoc from a shell script, with multiple passes. The HTML 
>>> template I am using here is fairly complex and should be used both for html 
>>> and chunkedhtml output.
>>>
>>> In the template, I have placed a navigation in a conditional (simplified 
>>> here):
>>>
>>> $-- $if(document-type-chunked)$
>>> <nav class="sitenav">
>>> <a href="$next.url$">$next.title$</a>$ <a 
>>> href="$previous.url$">$previous.title$</a>
>>> </nav>
>>> $-- $endif$
>>>
>>> In the shell script, I set this meta variable (document-type-chunked):
>>>
>>> pandoc --standalone $(basename $file) --to=chunkedhtml --metadata 
>>> document-type-chunked=true --output=${outputname%.*}
>>>
>>> The metadata variable is still true for the first page of the chunked 
>>> output (index.html), but not for the remaining chunks, so they get no 
>>> navigation.
>>>
>>> Am I making a mistake?
>>>
>>> I realize I could also put conditionals around each single navigation 
>>> item ($if(next.url)$), but it would be easier to build complex templates if 
>>> I could pass a variable to the template.
>>>
>>> Could this be resolved differently?
>>>
>>> Thank you.
>>>
>>> -- 
>>> 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/pandoc-discuss/b8b475d4-9741-41b0-add8-8b057e6e867fn%40googlegroups.com 
>>> <https://groups.google.com/d/msgid/pandoc-discuss/b8b475d4-9741-41b0-add8-8b057e6e867fn%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/71cbde8f-0eb8-432f-9718-5b3ff807e210n%40googlegroups.com.

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

[-- Attachment #2: chunking_test_results.png --]
[-- Type: image/png, Size: 163514 bytes --]

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

end of thread, other threads:[~2023-02-13 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-13 11:32 chunkedhtml - metadata variable for template reset after first chunk Martin Post
     [not found] ` <b8b475d4-9741-41b0-add8-8b057e6e867fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-13 11:53   ` 'William Lupton' via pandoc-discuss
     [not found]     ` <CAEe_xxhfNevy=fxs1yvLN3zxVm=Z8exGVyXL3s3yNMYm3cCT_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-02-13 12:01       ` Martin Post
     [not found]         ` <b065b793-9825-41a8-89f0-a315f6d70e26n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-13 13:44           ` Martin Post

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