Changeset 13413


Ignore:
Timestamp:
2006-12-05T11:43:25+13:00 (17 years ago)
Author:
kjdon
Message:

added some special handling for year so that it only gets 4 digits. Also added some comments to keep emacs colouring working properly

File:
1 edited

Legend:

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

    r12169 r13413  
    221221        $value =~ s/^"//; $value =~ s/"$//;
    222222    }
    223     $value = &process_latex($value);
    224 
    225     # Add this line of metadata
    226     $metadata{$entryname} .= "$value";
    227        
     223   
     224    # special case for year - we only want a 4 digit year, not
     225    # "circa 2004" etc
     226    if ($entryname=~ /^year$/i) {
     227        if ($value=~ /(\d{4})/) {
     228        $value=$1;
     229        $metadata{$entryname} .= "$value";
     230        }
     231    }
     232    else {
     233       
     234        $value = &process_latex($value);
     235        # Add this line of metadata
     236        $metadata{$entryname} .= "$value"; 
     237    }
    228238    }
    229239
     
    365375    # Add the various fields as metadata   
    366376    $doc_obj->add_utf8_metadata ($cursection, $name, $value);
     377   
    367378    }
    368379
     
    692703    # remove space (if any) between \ and letter to accent (eg {\' a})
    693704
    694     $text =~ s@(\\[`'="^~\.])\s(\w)@$1$2@g;
    695 
     705    $text =~ s@(\\[`'="^~\.])\s(\w)@$1$2@g; #`
     706           
    696707    # remove {} around a single character (eg \'{e})
    697     $text =~ s@(\\[`'="^~\.]){(\w)}@{$1$2}@g;
     708    $text =~ s@(\\[`'="^~\.]){(\w)}@{$1$2}@g; #`
    698709
    699710    # \, is another way of doing cedilla \c
     
    707718    if ($text =~ m|\\|) {
    708719    # "normal" accents - ie non-alpha latex tag
    709     while ($text =~ m@\\([`'="^~\.])([\w])@) {
     720    while ($text =~ m@\\([`'="^~\.])([\w])@) { #`
    710721        my $tex="$1$2"; my $char="$2";
    711722        my $replacement=$utf8_chars{$tex};
Note: See TracChangeset for help on using the changeset viewer.