]> wagner.pp.ru Git - fiction/Kate-the-Empress.git/commitdiff
update version and date in the document-info on each compile
authorVictor Wagner <wagner@atlas-card.ru>
Thu, 14 Nov 2013 12:39:43 +0000 (16:39 +0400)
committerVictor Wagner <wagner@atlas-card.ru>
Thu, 14 Nov 2013 12:39:43 +0000 (16:39 +0400)
Tex2fb2
fb2meta.xml

diff --git a/Tex2fb2 b/Tex2fb2
index 12f50da94cbca1d0b11758a5f6f08b85455a621d..22d83434cdcc887bf7382299656a993c4ac007ee 100755 (executable)
--- 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 (<F>) {
+       # Replace empty date with current date
+       if (/<date\s+\/>/ || /<date>\s*<\/date>/) {
+               $_ = "<date value=\">".strftime("%Y-%m-%d",localtime())."\">".
+                       strftime("%d/%m/%Y",localtime())."</date>\n";
+       }
+       # Add current to date as fractional part to version
+       if (/<version>(\d*)(.\d*)?<\/version>/) {
+               my $ver = $1+time()/1E10;
+               $_=tag(sprintf("%g",$ver),"version")."\n";
+       }
        print $_;
 }
 close F;
index 1caa5168b6360953d5b897de34f7cecd132203c7..f1d2f9d744227b96f23524fd4f426818cc5ee78a 100644 (file)
 <document-info>
 <author><first-name>Виктор</first-name><last-name>Вагнер</last-name></author>
 <program-used>Perl</program-used>
-<date value="2013-11-12">12.11.2013</date>
+<date />
 <src-url>http://www.wagner.pp.ru/~vitus/fiction</src-url>
-<id>00000</id>
-<version>0.8</version>
+<id>5056261e-13f6-4386-83be-2a363304fab3</id>
+<version>0.0</version>
 </document-info>
 
 </description>