Cloudy & Associates

Commit 7ec23659 authored by Chatzikos, Marios's avatar Chatzikos, Marios
Browse files

Report empty files after processing refs (BUGFIX)

The previous implementation reported a file as empty based on the
presence of a 'Reference' line.

Some files that contain the line but are not followed by any references,
were not reported as empty.  This is now fixed.
parent 91b7880f
......@@ -143,6 +143,8 @@
# - always prune non-existent refs from data structure (for JSON file),
# not only in interactive mode;
# - process ADAS refs, and private communications;
# - report files without references, after the references have been
# processed (BUGFIX).
#
use warnings;
......@@ -1719,6 +1721,7 @@ sub get_file_references
print "filename= '$filename'\n";
print "db = '$db'\n";
}
my $contents = &BiblioToTeX::read_contents( $filename );
my $data;
if( $db eq 'stout' )
......@@ -1727,16 +1730,20 @@ sub get_file_references
my $refs = &get_stout_refs( $db, $contents );
$data = $contents;
$contents = $refs;
&report_empty_files( "../data/stout/".$filename, $data, $refs );
}
else
{
$data = &get_data( $db, $contents );
}
return
if( not @$data );
# print "data:\t". @$data ."\n";
# print "rest:\t". @$contents ."\n";
if( 0 )
{
print "data:\t". @$data ."\n";
print "rest:\t". @$contents ."\n";
}
my $refs;
if( $db eq "stout" )
......@@ -1752,7 +1759,6 @@ sub get_file_references
$refs = &parse_lamda_comments( $filename, $contents );
}
if( defined( $interactive ) )
{
# &report_refs( $refs );
......@@ -1767,6 +1773,9 @@ sub get_file_references
&update_datafile( $bibcodes, $contents, $filename )
if( defined( $interactive ) and $db eq "stout" );
&report_empty_files( "../data/stout/".$filename, $data, $refs )
if( $db eq 'stout' );
return $refs;
}
......@@ -1895,7 +1904,7 @@ sub update_refs_data
# Now do the reverse: prune all stored data that are not in the
# current version of the file
my @rm_index;
# print @{ $$refs_data{$sp}{ref}{$datatype} }."\n";
print @{ $$refs_data{$sp}{ref}{$datatype} }."\n" if 0;
for( my $iref = 0; $iref < @{ $$refs_data{$sp}{ref}{$datatype} }; $iref++ )
{
my $ref = $$refs_data{$sp}{ref}{$datatype}[ $iref ];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment