Jan Kröger
2015-03-09 09:44:47 UTC
Hi,
as long as I understood, it is possible to set a pandoc template condition
which asks if a variable's value is not zero.
But want I need is to create a condition which asks for a variable with a
certain value.
Is that possible?
An example: I want pandoc to write some yaml metadata (contributors names)
to the epub's titlepage to give the different contributors their
credentials (put a label in front of the name).
I have set them in yaml metadata block like:
contributor:
- role: edt
text: Person1
- role: pfr
text: Person2
- role: pht
text: Person3
- role: trl
text:
What works is a simple list of different contributors, set in my custom
template:
$for(contributor)$
$contributor.text$$sep$,
$endfor$
so with:
pandoc metadata.yaml book-content.md -t epub3 -o book.epub
I got a list of all contributors written to the title page:
Person1, Person2, Person3
But what I want instead is this:
Editor: Person1
Proofreader: Person2
Photographer: Person3
So what I am missing is the possibility to set e.g.:
$for(contributor)$
$if(contributor.role)==edt$
<p>Editor: $contributor.text$</p>
$endif$
$if(contributor.role)==pfr$
<p>Proofreader: $contributor.text$</p>
$endif$
$if(contributor.role)==pht$
<p>Photographer: $contributor.text$</p>
$endif$
$endfor$
(Which can't work because it seems this syntax is not implemented.)
How can that be done as long as I use standard conform yaml metadata? I use
latest pandoc 1.13.2.
as long as I understood, it is possible to set a pandoc template condition
which asks if a variable's value is not zero.
But want I need is to create a condition which asks for a variable with a
certain value.
Is that possible?
An example: I want pandoc to write some yaml metadata (contributors names)
to the epub's titlepage to give the different contributors their
credentials (put a label in front of the name).
I have set them in yaml metadata block like:
contributor:
- role: edt
text: Person1
- role: pfr
text: Person2
- role: pht
text: Person3
- role: trl
text:
What works is a simple list of different contributors, set in my custom
template:
$for(contributor)$
$contributor.text$$sep$,
$endfor$
so with:
pandoc metadata.yaml book-content.md -t epub3 -o book.epub
I got a list of all contributors written to the title page:
Person1, Person2, Person3
But what I want instead is this:
Editor: Person1
Proofreader: Person2
Photographer: Person3
So what I am missing is the possibility to set e.g.:
$for(contributor)$
$if(contributor.role)==edt$
<p>Editor: $contributor.text$</p>
$endif$
$if(contributor.role)==pfr$
<p>Proofreader: $contributor.text$</p>
$endif$
$if(contributor.role)==pht$
<p>Photographer: $contributor.text$</p>
$endif$
$endfor$
(Which can't work because it seems this syntax is not implemented.)
How can that be done as long as I use standard conform yaml metadata? I use
latest pandoc 1.13.2.
--
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+***@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/3cd16275-1460-4335-be0c-36d9c3b0ca07%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+***@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/3cd16275-1460-4335-be0c-36d9c3b0ca07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.