2

I have a markdown file that starts like this:

--- 
title: Some Title
author: 
- family: Barson
  given: Foobius
---

And I'd like to get pandoc to extract this information and output it. So I have a simple template that looks like this:

title: $title$
author: $author$
author given: $author.given$ 
author family: $author.family$

Yet when I run pandoc my-file.md --template=my-template.html, I get this:

title: Some Title
author: true
author given:  
author family: 

But what I was expecting to get was be this:

title: Some Title
author: Foobius Barson
author given:  Foobius
author family: Barson

What am I doing wrong with this pandoc template?

Jonathan
  • 2,139

1 Answers1

2

Figured it out myself. It turns out I just had to wrap the $author.given$s in a for loop:

$for(author)$
author given: $author.given$
author family: $author.family$
$endfor$
Jonathan
  • 2,139