EPUB, EPUB3 templates: Handle structured metadata on titlepage.

Previously we just expected 'title', 'subtitle', 'author', 'date'.

Now we still support those, but also support the format recommended
for epub metadata in the pandoc README:

---
title:
- type: main
  text: My Book
- type: subtitle
  text: An investigation of metadata
creator:
- role: author
  text: John Smith
- role: editor
  text: Sarah Jones
identifier:
- scheme: DOI
  text: doi:10.234234.234/33
publisher:  My Press
rights:  (c) 2007 John Smith, CC BY-NC
...
This commit is contained in:
John MacFarlane 2014-08-31 12:00:37 -07:00
parent 7be841cee6
commit 2d5491bc0b
2 changed files with 38 additions and 8 deletions

View file

@ -17,15 +17,30 @@ $endfor$
</head> </head>
<body> <body>
$if(titlepage)$ $if(titlepage)$
$for(title)$
$if(title.text)$
<h1 class="$title.type$">$title.text$</h1>
$else$
<h1 class="title">$title$</h1> <h1 class="title">$title$</h1>
$endif$
$endfor$
$if(subtitle)$ $if(subtitle)$
<h1 class="subtitle">$subtitle$</h1> <h1 class="subtitle">$subtitle$</h1>
$endif$ $endif$
$for(author)$ $for(author)$
<h2 class="author">$author$</h2> <h2 class="author">$author$</h2>
$endfor$ $endfor$
$for(creator)$
<h2 class="$creator.type$">$creator.text$</h2>
$endfor$
$if(publisher)$
<p class="publisher">$publisher$</p>
$endif$
$if(date)$ $if(date)$
<h3 class="date">$date$</h3> <p class="date">$date$</p>
$endif$
$if(rights)$
<p class="rights">$rights$</p>
$endif$ $endif$
$else$ $else$
$body$ $body$

View file

@ -22,15 +22,30 @@ $endfor$
<body> <body>
$if(titlepage)$ $if(titlepage)$
<section epub:type="titlepage"> <section epub:type="titlepage">
$for(title)$
$if(title.type)$
<h1 class="$title.type$">$title.text$</h1>
$else$
<h1 class="title">$title$</h1> <h1 class="title">$title$</h1>
$endif$
$endfor$
$if(subtitle)$ $if(subtitle)$
<h1 class="subtitle">$subtitle$</h1> <h1 class="subtitle">$subtitle$</h1>
$endif$ $endif$
$for(author)$ $for(author)$
<h2 class="author">$author$</h2> <h2 class="author">$author$</h2>
$endfor$ $endfor$
$for(creator)$
<h2 class="$creator.type$">$creator.text$</h2>
$endfor$
$if(publisher)$
<p class="publisher">$publisher$</p>
$endif$
$if(date)$ $if(date)$
<h3 class="date">$date$</h3> <p class="date">$date$</p>
$endif$
$if(rights)$
<p class="rights">$rights$</p>
$endif$ $endif$
</section> </section>
$else$ $else$