From: Victor Wagner Date: Thu, 14 Nov 2013 12:39:43 +0000 (+0400) Subject: update version and date in the document-info on each compile X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=0387dbe081b6d275160f7109e992e7eca30ce74d;p=fiction%2FKate-the-Empress.git update version and date in the document-info on each compile --- diff --git a/Tex2fb2 b/Tex2fb2 index 12f50da..22d8343 100755 --- a/Tex2fb2 +++ b/Tex2fb2 @@ -1,5 +1,6 @@ #!/usr/bin/perl -CDS use utf8; +use POSIX qw(strftime); # char-level modes my $poetry = 0; my $verbatim = 0; @@ -19,6 +20,16 @@ xmlns:l=\"http://www.w3.org/1999/xlink\">\n"; my $metadata = shift @ARGV; open F,"<",$metadata; while () { + # Replace empty date with current date + if (// || /\s*<\/date>/) { + $_ = "".strftime("%Y-%m-%d",localtime())."\">". + strftime("%d/%m/%Y",localtime())."\n"; + } + # Add current to date as fractional part to version + if (/(\d*)(.\d*)?<\/version>/) { + my $ver = $1+time()/1E10; + $_=tag(sprintf("%g",$ver),"version")."\n"; + } print $_; } close F; diff --git a/fb2meta.xml b/fb2meta.xml index 1caa516..f1d2f9d 100644 --- a/fb2meta.xml +++ b/fb2meta.xml @@ -26,10 +26,10 @@ ВикторВагнер Perl -12.11.2013 + http://www.wagner.pp.ru/~vitus/fiction -00000 -0.8 +5056261e-13f6-4386-83be-2a363304fab3 +0.0