From 2d5491bc0b167a5b20c03e4bc02ef8b5fc20379f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 31 Aug 2014 12:00:37 -0700 Subject: [PATCH] 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 ... --- default.epub | 17 ++++++++++++++++- default.epub3 | 29 ++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/default.epub b/default.epub index 4b51f441c..0ac58248f 100644 --- a/default.epub +++ b/default.epub @@ -17,15 +17,30 @@ $endfor$ $if(titlepage)$ +$for(title)$ +$if(title.text)$ +

$title.text$

+$else$

$title$

+$endif$ +$endfor$ $if(subtitle)$

$subtitle$

$endif$ $for(author)$

$author$

$endfor$ +$for(creator)$ +

$creator.text$

+$endfor$ +$if(publisher)$ +

$publisher$

+$endif$ $if(date)$ -

$date$

+

$date$

+$endif$ +$if(rights)$ +

$rights$

$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$ $if(titlepage)$ -
-

$title$

+
+$for(title)$ +$if(title.type)$ +

$title.text$

+$else$ +

$title$

+$endif$ +$endfor$ $if(subtitle)$ -

$subtitle$

+

$subtitle$

$endif$ $for(author)$ -

$author$

+

$author$

$endfor$ -$if(date)$ -

$date$

+$for(creator)$ +

$creator.text$

+$endfor$ +$if(publisher)$ +

$publisher$

$endif$ -
+$if(date)$ +

$date$

+$endif$ +$if(rights)$ +

$rights$

+$endif$ +
$else$ $body$ $endif$