Changeset 21801


Ignore:
Timestamp:
2010-03-17T13:01:20+13:00 (12 years ago)
Author:
kjdon
Message:

extended HTMLPlugin's metadata_field_separator option to Word and StructuredHTML plugins

Location:
main/trunk/greenstone2/perllib/plugins
Files:
2 edited

Legend:

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

    r19993 r21801  
    365365    return if (!defined $textref);
    366366
     367    my $separator = $self->{'metadata_field_separator'};
     368    if ($separator eq "") {
     369    undef $separator;
     370    }
    367371    # metadata fields to extract/save. 'key' is the (lowercase) name of the
    368372    # html meta, 'value' is the metadata name for greenstone to use
     
    395399        #print $outhandle " extracted \"$tag\" metadata \"$value\"\n"
    396400        #    if ($self->{'verbosity'} > 2);
    397         $doc_obj->add_utf8_metadata($doc_obj->get_top_section(), $tag, $value);
     401        if (defined $separator) {
     402            my @values = split($separator, $value);
     403            foreach my $v (@values) {
     404            $doc_obj->add_utf8_metadata($doc_obj->get_top_section(), $tag, $v) if $v =~ /\S/;
     405            }
     406        }
     407        else {
     408            $doc_obj->add_utf8_metadata($doc_obj->get_top_section(), $tag, $value);
     409        }
    398410        }
    399411    }
  • main/trunk/greenstone2/perllib/plugins/WordPlugin.pm

    r20790 r21801  
    6565             'type' => "string",
    6666             'deft' => "Title" },
     67               { 'name' => "metadata_field_separator",
     68             'desc' => "{HTMLPlugin.metadata_field_separator}",
     69             'type' => "string",
     70             'deft' => "" },
    6771               { 'name' => "level1_header",
    6872             'desc' => "{StructuredHTMLPlugin.level1_header}",
     
    139143        push (@$structhtml_options, "-level3_header", $self->{'level3_header'}) if $self->{'level3_header'};
    140144        push (@$structhtml_options, "-metadata_fields", $self->{'metadata_fields'}) if $self->{'metadata_fields'};
     145        push (@$structhtml_options, "-metadata_field_separator", $self->{'metadata_field_separator'}) if $self->{'metadata_field_separator'};
    141146    }
    142147    }
Note: See TracChangeset for help on using the changeset viewer.