From 6d7003753d3b6557a274aa5c82450b954ff568cb Mon Sep 17 00:00:00 2001 From: sejo Date: Sat, 8 Jan 2022 19:29:20 -0600 Subject: [PATCH] use header image from metadata.txt --- g2e.awk | 12 ++++++------ templates/content-header.opf | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/g2e.awk b/g2e.awk index 61f7a69..e33917e 100644 --- a/g2e.awk +++ b/g2e.awk @@ -17,6 +17,10 @@ BEGIN{ value = $2 for(i=3;i<=NF;i++) value = value " " $i + if(key=="cover"){ + sub(/^.+\//,"",value) # get basename + } + meta[key] = value # set index file as an argument to be read @@ -53,8 +57,7 @@ BEGIN{ } # start writing metadata files - content_header = write_template( "content-header.opf", meta ) - content = write_template("content-manifest-header.opf", meta ) + content = write_template("content-header.opf", meta ) toc = write_template( "toc-header.ncx", meta ) spinetoc = " \n" } @@ -110,18 +113,15 @@ ARGIND==2 && FNR==1{ sub(/^.+\//,"",id) # get basename properties = "" - if(id~/cover/){ + if(id~meta["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 90c91ba..79f2778 100644 --- a/templates/content-header.opf +++ b/templates/content-header.opf @@ -8,3 +8,9 @@ {author} {description} {publishDate} + + + + + +