Ignore:
Timestamp:
2003-06-25T09:45:41+12:00 (21 years ago)
Author:
davidb
Message:

Modified so BibTeX records with no key processed correctly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/BibTexPlug.pm

    r4744 r4792  
    129129         'keywords', 'Keywords',
    130130         'abstract', 'Abstract',
    131          'copyright', 'Copyright'
     131         'copyright', 'Copyright',
     132         'note', 'Note',
    132133);
    133134
    134135    # Metadata fields
    135136    my %metadata;
    136     my ($EntryType, $EntryID, $Creator, $Keywords, $text);
     137    my ($EntryType, $Creator, $Keywords, $text);
    137138
    138139    my $verbosity = $self->{'verbosity'};
     
    142143    # append line to previous if it doesn't start with "  <key> = "
    143144
    144     my @input_lines=split('\n', $$textref);
     145    my @input_lines=split(/\r?\n/, $$textref);
    145146    my @all_lines;
    146147    my $entry_line=shift @input_lines;
     
    161162    push(@all_lines, "}");
    162163
    163 
    164 
    165164    # Read and process each line in the bib file.
    166165    my ($entryname, $name, $value, $line);
     
    174173    $text .= "$line\n";
    175174
     175
    176176    print "Processing line = $line \n" if $verbosity>=4;
    177177
    178178    # The first line is special, it contains the reference type and OID
    179     if ($line =~ /\@(\w+)\W*\{\W*([\*\.\w\d:-]+)\W*$/) {
     179    if ($line =~ /\@(\w+)\W*\{\W*([\*\.\w\d:-]*)\W*$/) {
    180180        $EntryType = $1;
    181         $EntryID = $2;
     181        my $EntryID = (defined $2) ? $2 : "default";
    182182        print "** $EntryType - \"$EntryID\" \n"
    183183        if ($verbosity >= 4);
    184         $self->{'key'} = $EntryID;
     184
    185185        next;
    186186    }
     
    775775   
    776776    if ( $self->{'key'} eq "default") {
    777     $doc_obj->set_OID();
     777    $doc_obj->set_OID("$id\_$segment_number");
    778778    } else {
    779779    $doc_obj->set_OID($self->{'key'});
     
    782782
    7837831;
     784
     785
Note: See TracChangeset for help on using the changeset viewer.