+ # 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";
+ }
+ # Если существует cover.png, добавляем coverpage
+ if (/<coverpage \/>/) {
+ $_="";
+ COVER:
+ for $file ("cover.jpg","cover.png") {
+ if (-f $file) {
+ my $id = $file;
+ $id=~tr/./_/;
+ $_ = "<coverpage>\n<image l:href=\"#$id\" />\n</coverpage>\n";
+ $pics .= mkbinary($file,$id);
+ last COVER;
+ }
+ }
+ }