From bca25140b8c9170b665ecf618d181773426a9e4a Mon Sep 17 00:00:00 2001 From: sejo Date: Sat, 8 Jan 2022 19:22:07 -0600 Subject: [PATCH] include cover image in metadata --- g2e.awk | 11 +++++++++-- templates/content-header.opf | 5 ----- templates/content-manifest-header.opf | 3 +++ 3 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 templates/content-manifest-header.opf diff --git a/g2e.awk b/g2e.awk index 5b6d0f4..61f7a69 100644 --- a/g2e.awk +++ b/g2e.awk @@ -53,7 +53,8 @@ BEGIN{ } # start writing metadata files - content = write_template( "content-header.opf", meta ) + content_header = write_template( "content-header.opf", meta ) + content = write_template("content-manifest-header.opf", meta ) toc = write_template( "toc-header.ncx", meta ) spinetoc = " \n" } @@ -108,13 +109,19 @@ ARGIND==2 && FNR==1{ id = dest sub(/^.+\//,"",id) # get basename - properties = id~/cover/ ? "properties=\"cover-image\"" : "" + properties = "" + if(id~/cover/){ + properties = "properties=\"cover-image\"" + content_header = content_header " \n" + } content = content " \n" } $0 = line # finalize metadata files + content_header = content_header " \n\n" content = content " \n\n" spinetoc " \n\n" + content = content_header content print content > epubodir "content.opf" toc = toc " \n" diff --git a/templates/content-header.opf b/templates/content-header.opf index 93b2339..90c91ba 100644 --- a/templates/content-header.opf +++ b/templates/content-header.opf @@ -8,8 +8,3 @@ {author} {description} {publishDate} - - - - - diff --git a/templates/content-manifest-header.opf b/templates/content-manifest-header.opf new file mode 100644 index 0000000..4d16c53 --- /dev/null +++ b/templates/content-manifest-header.opf @@ -0,0 +1,3 @@ + + +