Ignore:
Timestamp:
2024-02-28T13:18:31+13:00 (3 months ago)
Author:
kjdon
Message:

when investigating how OIDs are set I noticed we have this add_OID code which is never called - the new name should be add_segment_OID. Secondly, back in 2017 setting the self->{'key'} was removed - accidentally? I have put it back. This is so that is a citekey is included in hte bibtex entry, we can use that for the doc ID

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/BibTexPlugin.pm

    r32129 r38802  
    190190
    191191
    192     print "Processing line = $line \n" if $verbosity>=4;
    193 
    194     # The first line is special, it contains the reference type and OID
    195     if ($line =~ /\@(\w+)\W*\{\W*([\*\.\w\d:-]*)\W*$/) {
    196         $EntryType = $1;
    197         my $EntryID = (defined $2) ? $2 : "default";
    198         print "** $EntryType - \"$EntryID\" \n"
    199         if ($verbosity >= 4);
    200 
     192    print STDERR "Processing line = $line \n" if $verbosity>=4;
     193
     194    # The first line is special, it contains the reference type and optional OID
     195        # oid (citekey) can contain alphanumeric, _, - and :
     196    if ($line =~ /\@(\w+)\W*\{\W*([\*\.\w:-]*)\W*$/) {
     197        $EntryType = $1; # eg @workingpaper
     198            my $EntryID = $2; # eg {Witen2020,
     199        print "** $EntryType - \"$EntryID\" \n" if ($verbosity >= 4);
     200            if (defined $EntryID && $EntryID =~ /\w+/) {
     201                $self->{'key'} = $EntryID;
     202            }
    201203        next;
    202204    }
     
    816818}
    817819
    818 sub add_OID {
     820sub add_segment_OID {
    819821    my $self = shift (@_);
    820822    my ($doc_obj, $id, $segment_number) = @_;
    821    
    822823    if ( $self->{'key'} eq "default") {
    823     $self->SUPER::add_OID(@_);
    824 #   $doc_obj->set_OID("$id\_$segment_number");
     824    $self->SUPER::add_segment_OID(@_);
    825825    } else {
    826826    $doc_obj->set_OID($self->{'key'});
Note: See TracChangeset for help on using the changeset viewer.