From 5ac6f7ba64a889e38bc3c05288647b800f9a6406 Mon Sep 17 00:00:00 2001 From: sejo Date: Fri, 11 Feb 2022 15:35:22 -0600 Subject: [PATCH] change content.opf template based on the presence of translator metadata --- g2e.awk | 8 +++++++- templates/content-header.opf | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/g2e.awk b/g2e.awk index f3092d8..292f2c4 100644 --- a/g2e.awk +++ b/g2e.awk @@ -13,6 +13,8 @@ BEGIN{ "date -u +%FT%TZ" | getline meta["date"] + content_header_template = "content-header.opf" + # read metadata file fields while( getline < metadatafile ){ key = $1; sub(":","",key) @@ -23,6 +25,10 @@ BEGIN{ sub(/^.+\//,"",value) # get basename } + if(key=="translator"){ + content_header_template = "content-header-translator.opf" + } + meta[key] = value # set index file as an argument to be read @@ -59,7 +65,7 @@ BEGIN{ } # start writing metadata files - content = write_template("content-header.opf", meta ) + content = write_template(content_header_template, meta ) toc = write_template( "toc-header.ncx", meta ) spinetoc = " \n" } diff --git a/templates/content-header.opf b/templates/content-header.opf index a0b80a1..b9fe72e 100644 --- a/templates/content-header.opf +++ b/templates/content-header.opf @@ -8,7 +8,6 @@ {author} {description} {publishDate} - {translator} {date}