Discussion:
yaml_metadata_block does not work as documented
kurt.pfeifle-gM/Ye1E23mwN+
2013-12-11 14:24:30 UTC
Permalink
I'm not familiar with YAML at all, and still struggling to get a grasp of
its syntax. However, since I'm wanting to include an abstract into a
LaTeX/PDF document, I thought I play a bit with YAML metadata blocks (since
they allow to put the abstract in -- and since I found [so far] no
different way to put an abstract into my Markdown).

My pandoc is the newest release, v1.12.2.1 (on a Mac), installed via cabal.

For a start, I used the identical YAML block that's documented at
http://johnmacfarlane.net/pandoc/demo/example9/pandocs-markdown.html

Here is my minimal source Markdown document, yaml.mmd:

*---*
*title: 'This is the title: it contains a colon'*
*author:*
*- name: Author One*
* affiliation: University of Somewhere*
*- name: Author Two*
* affiliation: University of Nowhere*
*tags: [nothing, nothingness]*
*abstract: |*
* This is the abstract.*

* It consists of two paragraphs.*
*...*

*# Heading*

*paragraph 1.*



My commandline was:

*pandoc --from=markdown+yaml_metadata_block --output=yaml.pdf yaml.mmd*

Here is a screenshot from the resulting PDF:

<Loading Image...>

As you can see there is neither author nor abstract appearing in the PDF.
However, this is the best of pandoc's outputs (at least it picks up the
title string). With HTML or LaTeX output, not even the title info gets
through to the final document:

- When I convert to HTML, I only get this as my yaml.html:

*<h1 id="heading">Heading</h1>*
*<p>paragraph 1.</p>*



- Converting to LaTeX results in this yaml.tex:

*\section{Heading}\label{heading}*
*paragraph 1.*


What am I doing wrong here?
--
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/***@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/665e2194-0441-4cac-a778-2997a2f42994%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
John MacFarlane
2013-12-11 18:47:42 UTC
Permalink
When you convert to html, use the -s flag. That will ensure
that the metadata is included. For pdf output, -s is implied,
but it doesn't hurt to specify it.

As for the others, I have added the following to the README,
after the YAML example you used:

Note: The example above will not work with the default templates.
The `author` variable in the templates expects a simple list or string,
and there is no `abstract` variable in most templates. To use these,
you would need to use a custom template with appropriate variables.
For example:

$for(author)$
$if(author.name)$
$author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
$else$
$author$
$endif$
$endfor$

$if(abstract)$
Abstract: $abstract$
$endif$
Post by kurt.pfeifle-gM/Ye1E23mwN+
I'm not familiar with YAML at all, and still struggling to get a grasp of
its syntax. However, since I'm wanting to include an abstract into a
LaTeX/PDF document, I thought I play a bit with YAML metadata blocks (since
they allow to put the abstract in -- and since I found [so far] no
different way to put an abstract into my Markdown).
My pandoc is the newest release, v1.12.2.1 (on a Mac), installed via cabal.
For a start, I used the identical YAML block that's documented at
http://johnmacfarlane.net/pandoc/demo/example9/pandocs-markdown.html
*---*
*title: 'This is the title: it contains a colon'*
*author:*
*- name: Author One*
* affiliation: University of Somewhere*
*- name: Author Two*
* affiliation: University of Nowhere*
*tags: [nothing, nothingness]*
*abstract: |*
* This is the abstract.*
* It consists of two paragraphs.*
*...*
*# Heading*
*paragraph 1.*
*pandoc --from=markdown+yaml_metadata_block --output=yaml.pdf yaml.mmd*
<https://lh3.googleusercontent.com/-ugdzGW7Jw7E/UqhylFGaSnI/AAAAAAAAAQ4/mBUtGCN8zJE/s1600/yaml.png>
As you can see there is neither author nor abstract appearing in the PDF.
However, this is the best of pandoc's outputs (at least it picks up the
title string). With HTML or LaTeX output, not even the title info gets
*<h1 id="heading">Heading</h1>*
*<p>paragraph 1.</p>*
*\section{Heading}\label{heading}*
*paragraph 1.*
What am I doing wrong here?
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/665e2194-0441-4cac-a778-2997a2f42994%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
kurt.pfeifle-gM/Ye1E23mwN+
2013-12-11 21:54:10 UTC
Permalink
Ok, thanks for this clarification!

Are you intending to fold these new features into the default templates,
sometime?

Thanks again.
Post by John MacFarlane
When you convert to html, use the -s flag. That will ensure
that the metadata is included. For pdf output, -s is implied,
but it doesn't hurt to specify it.
As for the others, I have added the following to the README,
Note: The example above will not work with the default templates.
The `author` variable in the templates expects a simple list or string,
and there is no `abstract` variable in most templates. To use these,
you would need to use a custom template with appropriate variables.
$for(author)$
$if(author.name)$
$author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
$else$
$author$
$endif$
$endfor$
$if(abstract)$
Abstract: $abstract$
$endif$
Post by kurt.pfeifle-gM/Ye1E23mwN+
I'm not familiar with YAML at all, and still struggling to get a grasp
of
Post by kurt.pfeifle-gM/Ye1E23mwN+
its syntax. However, since I'm wanting to include an abstract into a
LaTeX/PDF document, I thought I play a bit with YAML metadata blocks
(since
Post by kurt.pfeifle-gM/Ye1E23mwN+
they allow to put the abstract in -- and since I found [so far] no
different way to put an abstract into my Markdown).
My pandoc is the newest release, v1.12.2.1 (on a Mac), installed via
cabal.
Post by kurt.pfeifle-gM/Ye1E23mwN+
For a start, I used the identical YAML block that's documented at
http://johnmacfarlane.net/pandoc/demo/example9/pandocs-markdown.html
*---*
*title: 'This is the title: it contains a colon'*
*author:*
*- name: Author One*
* affiliation: University of Somewhere*
*- name: Author Two*
* affiliation: University of Nowhere*
*tags: [nothing, nothingness]*
*abstract: |*
* This is the abstract.*
* It consists of two paragraphs.*
*...*
*# Heading*
*paragraph 1.*
*pandoc --from=markdown+yaml_metadata_block --output=yaml.pdf yaml.mmd*
<
https://lh3.googleusercontent.com/-ugdzGW7Jw7E/UqhylFGaSnI/AAAAAAAAAQ4/mBUtGCN8zJE/s1600/yaml.png>
Post by kurt.pfeifle-gM/Ye1E23mwN+
As you can see there is neither author nor abstract appearing in the
PDF.
Post by kurt.pfeifle-gM/Ye1E23mwN+
However, this is the best of pandoc's outputs (at least it picks up the
title string). With HTML or LaTeX output, not even the title info gets
*<h1 id="heading">Heading</h1>*
*<p>paragraph 1.</p>*
*\section{Heading}\label{heading}*
*paragraph 1.*
What am I doing wrong here?
--
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/***@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/2aae1406-b1b2-4af0-913c-38a06594444a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
John MacFarlane
2013-12-12 06:11:45 UTC
Permalink
Post by kurt.pfeifle-gM/Ye1E23mwN+
Ok, thanks for this clarification!
Are you intending to fold these new features into the default templates,
sometime?
I've just added 'abstract' to the default latex template.

I'm reluctant to add support for structured authors, since different
formats have different requirements. (E.g. docbook wants family
name separated off.) For now it may be better to give users the
flexibility to do fancy things, while keeping the defaults simple.
Post by kurt.pfeifle-gM/Ye1E23mwN+
Thanks again.
Post by John MacFarlane
When you convert to html, use the -s flag. That will ensure
that the metadata is included. For pdf output, -s is implied,
but it doesn't hurt to specify it.
As for the others, I have added the following to the README,
Note: The example above will not work with the default templates.
The `author` variable in the templates expects a simple list or string,
and there is no `abstract` variable in most templates. To use these,
you would need to use a custom template with appropriate variables.
$for(author)$
$if(author.name)$
$author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
$else$
$author$
$endif$
$endfor$
$if(abstract)$
Abstract: $abstract$
$endif$
Post by kurt.pfeifle-gM/Ye1E23mwN+
I'm not familiar with YAML at all, and still struggling to get a grasp
of
Post by kurt.pfeifle-gM/Ye1E23mwN+
its syntax. However, since I'm wanting to include an abstract into a
LaTeX/PDF document, I thought I play a bit with YAML metadata blocks
(since
Post by kurt.pfeifle-gM/Ye1E23mwN+
they allow to put the abstract in -- and since I found [so far] no
different way to put an abstract into my Markdown).
My pandoc is the newest release, v1.12.2.1 (on a Mac), installed via
cabal.
Post by kurt.pfeifle-gM/Ye1E23mwN+
For a start, I used the identical YAML block that's documented at
http://johnmacfarlane.net/pandoc/demo/example9/pandocs-markdown.html
*---*
*title: 'This is the title: it contains a colon'*
*author:*
*- name: Author One*
* affiliation: University of Somewhere*
*- name: Author Two*
* affiliation: University of Nowhere*
*tags: [nothing, nothingness]*
*abstract: |*
* This is the abstract.*
* It consists of two paragraphs.*
*...*
*# Heading*
*paragraph 1.*
*pandoc --from=markdown+yaml_metadata_block --output=yaml.pdf yaml.mmd*
<
https://lh3.googleusercontent.com/-ugdzGW7Jw7E/UqhylFGaSnI/AAAAAAAAAQ4/mBUtGCN8zJE/s1600/yaml.png>
Post by kurt.pfeifle-gM/Ye1E23mwN+
As you can see there is neither author nor abstract appearing in the
PDF.
Post by kurt.pfeifle-gM/Ye1E23mwN+
However, this is the best of pandoc's outputs (at least it picks up the
title string). With HTML or LaTeX output, not even the title info gets
*<h1 id="heading">Heading</h1>*
*<p>paragraph 1.</p>*
*\section{Heading}\label{heading}*
*paragraph 1.*
What am I doing wrong here?
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/2aae1406-b1b2-4af0-913c-38a06594444a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
kurt.pfeifle-gM/Ye1E23mwN+
2013-12-12 19:00:11 UTC
Permalink
Post by John MacFarlane
Post by kurt.pfeifle-gM/Ye1E23mwN+
Ok, thanks for this clarification!
Are you intending to fold these new features into the default templates,
sometime?
I've just added 'abstract' to the default latex template.
I'm reluctant to add support for structured authors,
I understand that.

since different
Post by John MacFarlane
formats have different requirements. (E.g. docbook wants family
name separated off.) For now it may be better to give users the
flexibility to do fancy things, while keeping the defaults simple.
I agree with that approach in general.

However, I would expect a single author from a YAML block to be supported
by default. Maybe it is already... I'll test and see.

Thanks for adding the abstract support the LaTeX template.
--
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/***@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/0259a911-a3bd-4702-8468-642050b7bce8%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Loading...