diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2014-08-31 12:00:37 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2014-08-31 12:00:37 -0700 |
| commit | 2d5491bc0b167a5b20c03e4bc02ef8b5fc20379f (patch) | |
| tree | d5c52fbc6ac28299ca0cc5bb622b12eaf3ac3d05 | |
| parent | 7be841cee65db23378e659f3be443effa15168a3 (diff) | |
| download | pandoc-2d5491bc0b167a5b20c03e4bc02ef8b5fc20379f.tar.gz | |
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
...
| -rw-r--r-- | default.epub | 17 | ||||
| -rw-r--r-- | default.epub3 | 27 |
2 files changed, 37 insertions, 7 deletions
diff --git a/default.epub b/default.epub index 4b51f441c..0ac58248f 100644 --- a/default.epub +++ b/default.epub @@ -17,15 +17,30 @@ $endfor$ </head> <body> $if(titlepage)$ +$for(title)$ +$if(title.text)$ + <h1 class="$title.type$">$title.text$</h1> +$else$ <h1 class="title">$title$</h1> +$endif$ +$endfor$ $if(subtitle)$ <h1 class="subtitle">$subtitle$</h1> $endif$ $for(author)$ <h2 class="author">$author$</h2> $endfor$ +$for(creator)$ + <h2 class="$creator.type$">$creator.text$</h2> +$endfor$ +$if(publisher)$ + <p class="publisher">$publisher$</p> +$endif$ $if(date)$ - <h3 class="date">$date$</h3> + <p class="date">$date$</p> +$endif$ +$if(rights)$ + <p class="rights">$rights$</p> $endif$ $else$ $body$ diff --git a/default.epub3 b/default.epub3 index 6e38b4c77..5e983a21a 100644 --- a/default.epub3 +++ b/default.epub3 @@ -21,18 +21,33 @@ $endfor$ </head> <body> $if(titlepage)$ - <section epub:type="titlepage"> - <h1 class="title">$title$</h1> +<section epub:type="titlepage"> +$for(title)$ +$if(title.type)$ + <h1 class="$title.type$">$title.text$</h1> +$else$ + <h1 class="title">$title$</h1> +$endif$ +$endfor$ $if(subtitle)$ - <h1 class="subtitle">$subtitle$</h1> + <h1 class="subtitle">$subtitle$</h1> $endif$ $for(author)$ - <h2 class="author">$author$</h2> + <h2 class="author">$author$</h2> $endfor$ +$for(creator)$ + <h2 class="$creator.type$">$creator.text$</h2> +$endfor$ +$if(publisher)$ + <p class="publisher">$publisher$</p> +$endif$ $if(date)$ - <h3 class="date">$date$</h3> + <p class="date">$date$</p> +$endif$ +$if(rights)$ + <p class="rights">$rights$</p> $endif$ - </section> +</section> $else$ $body$ $endif$ |
