Changeset 36533


Ignore:
Timestamp:
2022-08-29T14:43:47+12:00 (5 weeks ago)
Author:
kjdon
Message:

added CSVPLugin option use_namespace_for_field_names - prepend the specified namespace to each field name. This namespace will need to be used in -filename_field and -OIDmetadata options, and in format statments

File:
1 edited

Legend:

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

    r36482 r36533  
    5858    'reqd' => "no",
    5959    'deft' => "Filename" },
    60       { 'name' => "store_raw_values_as_text",
    61     'desc' => "{CSVPlugin.store_raw_values_as_text}",
    62     'type' => "flag",
    63     'reqd' => "no"},
    6460       { 'name' => "no_document_if_source_unspecified",
    6561    'desc' => "{CSVPlugin.no_document_if_source_unspecified}",
     
    7066    'type' => "flag",
    7167    'reqd' => "no"},
     68      { 'name' => "use_namespace_for_field_names",
     69    'desc' => "{CSVPlugin.use_namespace_for_field_names}",
     70    'type' => "string",
     71    'reqd' => "no"},
    7272       { 'name' => "store_field_values_as_document_text",
    7373    'desc' => "{CSVPlugin.store_field_values_as_document_text}",
     
    106106    $self->{'textcat_store'} = {};
    107107    $self->{'metapass_srcdoc'} = {}; # which segments have valid metadata_srcdoc
     108
     109    if ($self->{'use_namespace_for_field_names'} =~ /^\s*$/) {
     110    $self->{'use_namespace_for_field_names'} = undef;
     111    }
     112
    108113    return bless $self, $class;
    109114}
     115
    110116
    111117# mark the file as a metadata file
     
    210216    $csv_file_fields[$i] =~ s/"$//;
    211217
     218    if ($self->{'use_namespace_for_field_names'}) {
     219        $csv_file_fields[$i] =  $self->{'use_namespace_for_field_names'}. "." . $csv_file_fields[$i];
     220    }
    212221    if ($csv_file_fields[$i] eq  $filename_field) {
    213222        $found_filename_field = 1;
    214     }
     223    } 
    215224    }
    216225
Note: See TracChangeset for help on using the changeset viewer.