Changeset 9998


Ignore:
Timestamp:
2005-06-01T15:47:06+12:00 (19 years ago)
Author:
mdewsnip
Message:

Changed this to work on Windows now that multiread sets binmode, and fixed the bug where the Keywords metadata was not being added correctly.

File:
1 edited

Legend:

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

    r8762 r9998  
    9090# This plugin splits the input text at the "----------" lines
    9191sub get_default_split_exp {
    92     return q^\n----------\n^;
     92    return q^\r?\n----------\r?\n^;
    9393}
    9494
     
    149149
    150150    # Map the tag numbers to tag names, using the FDT mapping
    151     $$textref =~ s/\ntag=(\d+) /\ntag=$fdtmapping{$1}{'title'} /g;
     151    $$textref =~ s/\r?\ntag=(\d+) /\ntag=$fdtmapping{$1}{'title'} /g;
    152152
    153153    # Remove the line at the start so it is split and processed properly
     
    206206        my $metadatafieldname = $tagname . $subfieldname;
    207207        my $metadatafieldvalue = $1;
    208 
    209         # Escape any '<' and '>' characters so they appear correctly in the final collection
    210         $metadatafieldvalue =~ s/\</&lt;/g;
    211         $metadatafieldvalue =~ s/\>/&gt;/g;
    212208       
    213209        # Handle Keywords specially
     
    215211            my $keywordmetadatavalue = $metadatafieldvalue;
    216212            my $keywordlist = "";
    217             while ($keywordmetadatavalue =~ s/\<([^\>]+)\>//) {
     213            while ($keywordmetadatavalue =~ s/\<(.+?)\>//) {
    218214            my $keyword = $1;
    219215            $doc_obj->add_utf8_metadata($cursection, $metadatafieldname, $keyword);
     
    225221        }
    226222
    227         else {
     223        # Escape any '<' and '>' characters so they appear correctly in the final collection
     224        $metadatafieldvalue =~ s/\</&lt;/g;
     225        $metadatafieldvalue =~ s/\>/&gt;/g;
     226
     227        # We have already added Keywords metadata above
     228        unless ($metadatafieldname eq "Keywords") {
    228229            $doc_obj->add_utf8_metadata($cursection, $metadatafieldname, $metadatafieldvalue);
    229230        }
Note: See TracChangeset for help on using the changeset viewer.