/[webpac]/branches/ffzg/all2xml.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /branches/ffzg/all2xml.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 259 by dpavlin, Thu Mar 11 18:23:59 2004 UTC revision 263 by dpavlin, Fri Mar 12 15:06:58 2004 UTC
# Line 210  sub data2xml { Line 210  sub data2xml {
210    
211                          # placeholder for all repeatable entries for index                          # placeholder for all repeatable entries for index
212    
                         sub chk_eval($) {  
                                 my $data = shift;  
                                 return if (! defined($data));  
                                 if ($data && $data =~ s/\s*eval{([^}]+)}\s*//) {  
                                         if (eval "$1") {  
                                                 return $data;  
                                         } else {  
                                                 return undef;  
                                         }  
                                 } else {  
                                         return $data;  
                                 }  
                         }  
   
213                          sub mkformat($$) {                          sub mkformat($$) {
214                                  my $x = shift || die "mkformat needs tag reference";                                  my $x = shift || die "mkformat needs tag reference";
215                                  my $data = shift || return;                                  my $data = shift || return;
216                                  my $format_name = x($x->{format_name}) || return chk_eval($data);                                  my $format_name = x($x->{format_name}) || return $data;
217                                  my $fmt = x($config->{format}->{$format_name}->{content}) || die "<format name=\"$format_name\"> is not defined!";                                  my $fmt = x($config->{format}->{$format_name}->{content}) || die "<format name=\"$format_name\"> is not defined!";
218                                  my $format_delimiter = x($x->{format_delimiter});                                  my $format_delimiter = x($x->{format_delimiter});
219                                  my @data;                                  my @data;
# Line 240  sub data2xml { Line 226  sub data2xml {
226                                  if ($fmt) {                                  if ($fmt) {
227                                          my $nr = scalar $fmt =~ s/%s/%s/g;                                          my $nr = scalar $fmt =~ s/%s/%s/g;
228                                          if (($#data+1) == $nr) {                                          if (($#data+1) == $nr) {
229                                                  return chk_eval(sprintf($fmt,@data));                                                  return sprintf($fmt,@data);
230                                          } else {                                          } else {
231                                                  #print STDERR "mkformat: [$data] can't be split on [$format_delimiter] to $nr fields!\n";                                                  #print STDERR "mkformat: [$data] can't be split on [$format_delimiter] to $nr fields!\n";
232                                                  return chk_eval($data);                                                  return $data;
233                                          }                                          }
234                                  } else {                                  } else {
235                                          print STDERR "usage of link '$format_name' without defined format (<link> tag)\n";                                          print STDERR "usage of link '$format_name' without defined format (<link> tag)\n";
# Line 298  sub data2xml { Line 284  sub data2xml {
284                                                  $tmp = join(" ",&$filter($tmp)) if ($s || $se);                                                  $tmp = join(" ",&$filter($tmp)) if ($s || $se);
285                                          }                                          }
286    
                                         $tmp = chk_eval($tmp);  
287                                          $swish_data .= $tmp if ($s && $tmp);                                          $swish_data .= $tmp if ($s && $tmp);
288                                          $swish_exact_data .= "xxbxx $tmp xxexx " if ($tmp && $tmp ne "" && $se);                                          $swish_exact_data .= "xxbxx $tmp xxexx " if ($tmp && $tmp ne "" && $se);
289                                  }                                  }
# Line 333  sub data2xml { Line 318  sub data2xml {
318                                                  no strict 'refs';                                                  no strict 'refs';
319                                                  $idisplay = &$filter($idisplay);                                                  $idisplay = &$filter($idisplay);
320                                          }                                          }
                                         $idisplay = chk_eval($idisplay);  
321                                          push @index_data, $idisplay if ($idisplay && !$iterate_by_page);                                          push @index_data, $idisplay if ($idisplay && !$iterate_by_page);
322                                  }                                  }
323    

Legend:
Removed from v.259  
changed lines
  Added in v.263

  ViewVC Help
Powered by ViewVC 1.1.26