Changeset 286 for trunk/gsdl/perllib


Ignore:
Timestamp:
1999-06-24T17:25:43+12:00 (25 years ago)
Author:
sjboddie
Message:

few changes mostly to get howto and organization classifications
building for hdl collection

Location:
trunk/gsdl/perllib/plugins
Files:
1 added
1 deleted
1 edited

Legend:

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

    r4 r286  
    55use html;
    66use BasPlug;
    7 
     7use util;
    88
    99sub BEGIN {
     
    136136    }
    137137    return 0 unless defined $jobnumber;
    138     my $htmlfile = "$base_dir$file/$jobnumber.htm";
     138    my $htmlfile = &util::filename_cat($base_dir, $file, "$jobnumber.htm");
    139139    return 0 unless -e $htmlfile;
    140140
     
    148148
    149149    # copy the book cover if it exists
    150     my $bookcover = "$base_dir$file/$jobnumber.jpg";
     150    my $bookcover = &util::filename_cat($base_dir, $file, "$jobnumber.jpg");
    151151    $doc_obj->associate_file($bookcover, "cover.jpg", "image/jpeg")
    152152    if -e $bookcover;
     
    190190
    191191        # add the metadata to this section
    192         if (!$firstsection || !defined($metadata->{'Title'})) {
    193         $doc_obj->add_metadata ($cursection, "Title", $title);
    194         }
     192        $doc_obj->add_metadata ($cursection, "Title", $title);
     193
    195194        if ($firstsection) {
    196195        foreach $field (keys(%$metadata)) {
    197             # Subjects may be a colon separated list
    198             if ($field eq "Subject") {
    199             my @subjects = split /:/, $metadata->{'Subject'};
    200             foreach $subject (@subjects) {
    201                 $doc_obj->add_metadata ($cursection, 'Subject', $subject);
    202             }
     196            # $metadata->{$field} may be an array reference
     197            if (ref ($metadata->{$field}) eq "ARRAY") {
     198            map {
     199                $doc_obj->add_metadata ($cursection, $field, $_);
     200            } @{$metadata->{$field}};
    203201            } else {
    204             $doc_obj->add_metadata ($cursection, $field, $metadata->{$field});
     202            $doc_obj->add_metadata ($cursection, $field, $metadata->{$field}); 
    205203            }
    206204        }
     
    216214#        split (/(_linkOID_\(_thisOID_\/[^\)]+\))/, $sectiontext);
    217215
    218         map { $doc_obj->associate_file("$base_dir$file/$1", $1)
     216        map { $doc_obj->associate_file(&util::filename_cat ($base_dir, $file, $1), $1)
    219217              if /_httpcollection_\/archives\/_thisOID_\/([^\"]+)\"/; 0; }
    220218             split (/(_httpcollection_\/archives\/_thisOID_\/[^\"]+\")/, $sectiontext);
     
    233231    $doc_obj->set_OID ();
    234232
    235     print STDERR "OID: ", $doc_obj->get_OID(), "\n";
    236 
    237233    # process the document
    238234    $processor->process($doc_obj);
Note: See TracChangeset for help on using the changeset viewer.