change content.opf template based on the presence of translator metadata

This commit is contained in:
sejo 2022-02-11 15:35:22 -06:00
parent 354a1a81a3
commit 5ac6f7ba64
2 changed files with 7 additions and 2 deletions

View File

@ -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 = " <spine toc=\"ncx\">\n"
}

View File

@ -8,7 +8,6 @@
<dc:creator id="creator">{author}</dc:creator>
<dc:description>{description}</dc:description>
<dc:date>{publishDate}</dc:date>
<dc:contributor id="translator">{translator}</dc:contributor>
<meta property="dcterms:modified">{date}</meta>
<meta content="{cover}" name="cover"/>
</metadata>