Ignore:
Timestamp:
2001-05-29T23:52:32+12:00 (23 years ago)
Author:
say1
Message:

Changed SplitPlug to allow control over the OID. Changed BibTexPlug to be more permissive in the Bibtex format it accepts. Changed BibTexPlug to use the BibTex key as the OID.

File:
1 edited

Legend:

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

    r1711 r2484  
    5757}
    5858
    59 
    6059# The process function reads a single bibliographic record and stores
    6160# it as a new document.
     
    6564    my ($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj) = @_;
    6665    my $outhandle = $self->{'outhandle'};
     66
     67    $self->{'key'} = "default";
    6768
    6869    # Check that we're dealing with a valid BibTex record
     
    125126    $text .= "$line\n";
    126127
     128   
    127129    # The first line is special, it contains the reference type and OID
    128     if ($line =~ /\@(\w+)\{([\w\d]*),/) {
     130    if ($line =~ /\@(\w+)\W*\{\W*([\*\.\w\d:-]+)\W*$/) {
    129131        $EntryType = $1;
    130132        $EntryID = $2;
    131         print "** $EntryType - $EntryID \n";
     133        print "** $EntryType - \"$EntryID\" \n"
     134        if ($verbosity >= 4);
     135        $self->{'key'} = $EntryID;
    132136        next;
     137    }
     138    if ($line =~ /\@/) {
     139        print "bibtexplug: suspect line in bibtex file: $line\n"
     140        if ($verbosity >= 2);
     141        print "bibtexplug: if that's the start of a new bibtex record ammend regexp in bibtexplug::process()\n"
     142        if ($verbosity >= 2);
    133143    }
    134144   
     
    227237}
    228238
    229 1;
    230 
    231239
    232240# Convert a text string into HTML.
     
    269277}
    270278
    271 
     279sub set_OID {
     280    my $self = shift (@_);
     281    my ($doc_obj, $id, $segment_number) = @_;
     282   
     283    if ( $self->{'key'} eq "default") {
     284    $doc_obj->set_OID();
     285    } else {
     286    $doc_obj->set_OID($self->{'key'});
     287    }
     288}
     289
     2901;
Note: See TracChangeset for help on using the changeset viewer.