Changeset 2484 for trunk


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.

Location:
trunk/gsdl/perllib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/doc.pm

    r2327 r2484  
    358358    }
    359359    }
    360 
    361360    $self->set_metadata_element ($self->get_top_section(), "Identifier", $OID);
    362361}
  • 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;
  • trunk/gsdl/perllib/plugins/SplitPlug.pm

    r2327 r2484  
    193193
    194194    # add an OID
    195     $doc_obj->set_OID($id . "s" . $segment);
     195    $self->set_OID($doc_obj, $id, $segment);
     196
    196197   
    197198    # process the document
     
    203204}
    204205
     206sub set_OID {
     207    my $self = shift (@_);
     208    my ($doc_obj, $id, $segment_number) = @_;
     209   
     210    $doc_obj->set_OID($id . "s" . $segment);
     211
     212}
    205213
    2062141;
Note: See TracChangeset for help on using the changeset viewer.