source: gsdl/trunk/perllib/plugins/OAIPlugin.pm@ 17290

Last change on this file since 17290 was 17290, checked in by kjdon, 16 years ago

previous changes to get exploding working (using metadata_read) meant that general coll building with this plugin stopped working :-(. So, I think I have fixed that, but it will have broken exploding in the meantime. I'll fix that next, but am going home now

  • Property svn:keywords set to Author Date Id Revision
File size: 18.6 KB
RevLine 
[4726]1###########################################################################
2#
3# OAIPlug.pm -- basic Open Archives Initiative (OAI) plugin
4#
5# A component of the Greenstone digital library software
6# from the New Zealand Digital Library Project at the
7# University of Waikato, New Zealand.
8#
9# Copyright (C) 1999 New Zealand Digital Library Project
10#
11# This program is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24#
25###########################################################################
26
[15872]27package OAIPlugin;
[4726]28
29use unicode;
30use util;
31
[10254]32use strict;
33no strict 'refs'; # allow filehandles to be variables and viceversa
34
[15872]35use ReadXMLFile;
[17066]36use ReadTextFile; # needed for subroutine textcat_get_language_encoding
[17216]37use metadatautil;
[9958]38
[4726]39sub BEGIN {
[17066]40 @OAIPlugin::ISA = ('ReadXMLFile', 'ReadTextFile');
[4726]41}
42
[9958]43
[6408]44my $arguments =
45 [ { 'name' => "process_exp",
[16013]46 'desc' => "{BasePlugin.process_exp}",
[6408]47 'type' => "regexp",
48 'reqd' => "no",
[17290]49 'deft' => &get_default_process_exp() },
50 { 'name' => "xxx",
51 'desc' => "{OAIPlugin.xxx}",
52 'type' => "metadata",
53 'reqd' => "no",
54 'deft' => "gi.Sourcedoc" }
[6408]55 ];
56
[15872]57my $options = { 'name' => "OAIPlugin",
58 'desc' => "{OAIPlugin.desc}",
[6408]59 'abstract' => "no",
60 'inherits' => "yes",
[17103]61 'explodes' => "yes",
[6408]62 'args' => $arguments };
[4747]63
[10254]64
[4726]65sub new {
[10218]66 my ($class) = shift (@_);
67 my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
68 push(@$pluginlist, $class);
[4873]69
[15872]70 push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
71 push(@{$hashArgOptLists->{"OptList"}},$options);
[4726]72
[17126]73 new ReadTextFile($pluginlist, $inputargs, $hashArgOptLists,1);
[15872]74 my $self = new ReadXMLFile($pluginlist, $inputargs, $hashArgOptLists);
[4726]75
76 return bless $self, $class;
77}
78
79sub get_default_process_exp {
80 my $self = shift (@_);
81
82 return q^(?i)(\.oai)$^;
83}
84
[13222]85sub get_doctype {
86 my $self = shift(@_);
87
88 return "OAI-PMH";
89}
90
[9958]91sub xml_start_document {
[10254]92 my $self = shift (@_);
[9958]93 $self->{'in_metadata_node'} = 0;
94 $self->{'rawxml'} = "";
[17290]95 $self->{'saved_metadata'} = {};
[9958]96}
[4726]97
[9958]98sub xml_end_document {
99}
[4726]100
[9958]101sub xml_doctype {
102 my $self = shift(@_);
103
104 my ($expat, $name, $sysid, $pubid, $internal) = @_;
105
[13886]106 ##die "" if ($name !~ /^OAI-PMH$/);
[9958]107
[4726]108 my $outhandle = $self->{'outhandle'};
[15872]109 print $outhandle "OAIPlugin: processing $self->{'file'}\n" if $self->{'verbosity'} > 1;
110 print STDERR "<Processing n='$self->{'file'}' p='OAIPlugin'>\n" if $self->{'gli'};
[4726]111
[9958]112}
[4726]113
[9958]114
115sub xml_start_tag {
116 my $self = shift(@_);
117 my ($expat,$element) = @_;
118
119 my %attr_hash = %_;
120
121 my $attr = "";
122 map { $attr .= " $_=$attr_hash{$_}"; } keys %attr_hash;
123
124 $self->{'rawxml'} .= "<$element$attr>";
125
126 if ($element eq "metadata") {
127 $self->{'in_metadata_node'} = 1;
128 $self->{'metadata_xml'} = "";
[4726]129 }
[9958]130
131 if ($self->{'in_metadata_node'}) {
132 $self->{'metadata_xml'} .= "<$element$attr>";
[4726]133 }
[9958]134}
[4726]135
[9958]136sub xml_end_tag {
137 my $self = shift(@_);
138 my ($expat, $element) = @_;
[4726]139
[9958]140 $self->{'rawxml'} .= "</$element>";
[4726]141
[9958]142 if ($self->{'in_metadata_node'}) {
143 $self->{'metadata_xml'} .= "</$element>";
[4726]144 }
145
[9958]146 if ($element eq "metadata") {
147 my $textref = \$self->{'metadata_xml'};
[17290]148 #my $metadata = $self->{'metadata'};
149 my $metadata = $self->{'saved_metadata'};
[9958]150 $self->extract_oai_metadata($textref,$metadata);
[4726]151
[9958]152 $self->{'in_metadata_node'} = 0;
153 }
[4726]154
155
[9958]156}
[4726]157
[9958]158sub xml_text {
159 my $self = shift(@_);
160 my ($expat) = @_;
[8684]161
[9958]162 $self->{'rawxml'} .= $_;
[4726]163
[9958]164 if ($self->{'in_metadata_node'}) {
165 $self->{'metadata_xml'} .= $_;
[4726]166 }
[9958]167}
[4726]168
[8121]169
[17216]170sub metadata_read {
171 my $self = shift (@_);
[4726]172
[17216]173 my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
[5919]174
[17216]175 # can we process this file??
176 my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
177 return undef unless $self->can_process_this_file($filename_full_path);
[17290]178# print STDERR "initial\n";
179# foreach my $k (keys %$metadata) {
180# print STDERR "$k=".join (", ", @{$metadata->{$k}})."; ";
181# }
182# print STDERR "\n";
[17216]183
184 my $total_count = 0; # is total count used?
[17290]185 if (!$self->parse_file($filename_full_path, $file, $gli)) {
186 $self->{'saved_metadata'} = undef;
187 return undef;
188 }
189
190 my $new_metadata = $self->{'saved_metadata'};
191 $self->{'saved_metadata'} = undef;
192 # add the pretty metadata table as metadata
193 my $ppmd_table = $self->{'ppmd_table'};
194 $new_metadata->{'prettymd'} = $ppmd_table;
195 $self->{'ppmd_table'} = undef;
196
197 print STDERR "after parse\n";
198 foreach my $k (keys %$new_metadata) {
199 print STDERR "$k=".join (", ", @{$new_metadata->{$k}})."; ";
200 }
201 print STDERR "\n";
202
203
204 # if ($self->SUPER::read($pluginfo,$base_dir,$file,$block_hash,$new_metadata,$processor,$maxdocs,$total_count, $gli)) {
205 # calling "SUPER::read" at this point sets up $metadata
206 # data-structure. We can then, later, in OAIPlug::read decide
207 # whether this $metadata will stick to an accompanying file,
208 # or else needs a new doc object to be formed that contains
209 # purely metadata
210
211# $self->{'metadata'} = undef;
212# print STDERR "after erad\n";
213# foreach my $k (keys %$metadata) {
214# print STDERR "$k=".join (", ", @{$metadata->{$k}})."; ";
215# }
216# print STDERR "\n";
217 my $url_array = $new_metadata->{'dc.Identifier'};
218 my $num_urls = (defined $url_array) ? scalar(@$url_array) : 0;
219 print STDERR "$num_urls urls for $file\n";
220 my $srcdoc_exists = 0;
221 my $srcdoc_pos = 0;
222 my $filename_dir = &util::filename_head($filename_full_path);
223 my $filename_for_metadata = $file;
224 for (my $i=0; $i<$num_urls; $i++) {
[17216]225
[17290]226 if ($url_array->[$i] !~ m/^(https?|ftp):/) {
[17216]227
[17290]228 my $src_filename = &util::filename_cat($filename_dir, $url_array->[$i]);
[17216]229
[17290]230 if (-e $src_filename) {
231 $srcdoc_pos = $i;
232 $srcdoc_exists = 1;
233 $filename_for_metadata = $url_array->[$i];
234 last;
[17216]235 }
236 }
237 }
[17290]238
239
240 if ($srcdoc_exists)
241 {
242 $self->{'oai-files'}->{$file}->{'srcdoc_exists'} = 1;
243 }
[17216]244 else {
[17290]245 # save the rawxml for the source document
246 $self->{'oai-files'}->{$file}->{'srcdoc_exists'} = 0;
247 $self->{'oai-files'}->{$file}->{'rawxml'} = $self->{'rawxml'};
248 $self->{'rawxml'} = "";
249 print STDERR "raw xml = $self->{'oai-files'}->{$file}->{'rawxml'}\n";
[17216]250 }
[17290]251
252### print STDERR "**** storing OAI file: $file\n";
253
254 # return all the metadata we have extracted to the caller.
255 # Directory plug will pass it back in at read time, so we don't need to extract it again.
256 $extrametadata->{$filename_for_metadata} = $new_metadata;
257 push(@$extrametakeys, $filename_for_metadata);
258
259 return 1;
260
[17216]261}
262
263
[9958]264sub read {
265 my $self = shift (@_);
[17290]266
[16392]267 my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
[4726]268
[17216]269
270### print STDERR "**** checking OAI read: $file\n";
271
[17290]272 if (!defined $self->{'oai-files'}->{$file}) {
273 return undef;
274 }
275
276
277 my $srcdoc_exists = $self->{'oai-files'}->{$file}->{'srcdoc_exists'};
278 if ($srcdoc_exists) {
279 # do nothing more
[17216]280 # no more need to access details of this $file => tidy up as you go
281 delete $self->{'oai-files'}->{$file};
[17290]282 return 0; # not processed here, but don't pass on to rest of plugins
283 }
[17216]284
285### print STDERR "**** !!!!! srcdoc_exists = $srcdoc_exists\n";
[17290]286
287 my $filename = $file;
288 $filename = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/;
[17216]289
[17290]290 # Do encoding stuff on metadata
291 my ($language, $encoding) = $self->textcat_get_language_encoding ($filename);
[17216]292
[17290]293 # create a new document
294 my $doc_obj = new doc ($filename, "indexed_doc");
295 my $top_section = $doc_obj->get_top_section;
296 my $plugin_type = $self->{'plugin_type'};
297
298 $doc_obj->add_utf8_metadata($top_section, "Language", $language);
299 $doc_obj->add_utf8_metadata($top_section, "Encoding", $encoding);
300 $doc_obj->add_utf8_metadata($top_section, "Plugin", $plugin_type);
301 $doc_obj->add_metadata($top_section, "FileFormat", "OAI");
302 $doc_obj->add_metadata($top_section, "FileSize", (-s $filename));
303
304 # include any metadata passed in from previous plugins
305 # note that this metadata is associated with the top level section
306 $self->extra_metadata ($doc_obj, $doc_obj->get_top_section(), $metadata);
307
308 # do plugin specific processing of doc_obj
309 print STDERR "raw xml 2 = $self->{'oai-files'}->{$file}->{'rawxml'}\n";
310 my $text = $self->{'oai-files'}->{$file}->{'rawxml'};
311 delete $self->{'oai-files'}->{$file};
[17216]312
[17290]313 unless (defined ($self->process(\$text, $pluginfo, $base_dir, $file, $metadata, $doc_obj))) {
314 print STDERR "<ProcessingError n='$file'>\n" if ($gli);
315 return -1;
[17216]316 }
[17290]317
318 # do any automatic metadata extraction
319 $self->auto_extract_metadata ($doc_obj);
320
321 # add an OID
322 $self->add_OID($doc_obj);
323
324 # process the document
325 $processor->process($doc_obj);
326
327 $self->{'num_processed'} ++;
328
329 return 1; # processed the file
[17216]330}
331
332
333sub read_old {
334 my $self = shift (@_);
[17290]335
[17216]336 my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
337
[9958]338 my $outhandle = $self->{'outhandle'};
[4726]339
[9958]340 my $filename = $file;
341 $filename = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/;
[4726]342
[17197]343 # block the srcdocs dir - we will process files in them when we find an OAI record for them
[9958]344 return 0 if ((-d $filename) && ($filename =~ m/srcdocs$/));
345 if ($self->SUPER::read(@_)) {
346 # Do encoding stuff
347 my ($language, $encoding) = $self->textcat_get_language_encoding ($filename);
348
[17197]349 my $url_array = $metadata->{'dc.Identifier'};
[10254]350 my $num_urls = (defined $url_array) ? scalar(@$url_array) : 0;
[9958]351
352 my $srcdoc_exists = 0;
353 my $srcdoc_pos = 0;
354 my $filename_dir = &util::filename_head($filename);
355
356 for (my $i=0; $i<$num_urls; $i++) {
357 if ($url_array->[$i] !~ m/^(http|ftp):/) {
358
359 my $src_filename = &util::filename_cat($filename_dir, $url_array->[$i]);
360 if (-e $src_filename) {
361 $srcdoc_pos = $i;
362 $srcdoc_exists = 1;
363 }
364 }
365 }
366
367 if ($srcdoc_exists)
368 {
[15872]369 print $outhandle "OAIPlugin: passing metadata on to $url_array->[0]\n"
[9958]370 if ($self->{'verbosity'}>1);
371
372
373 # Make pretty print metadata table stick with src filename
374 my $ppmd_table = $self->{'ppmd_table'};
375 $metadata->{'prettymd'} = [ $ppmd_table ];
376 $self->{'ppmd_table'} = undef;
377
378 return &plugin::read ($pluginfo, $filename_dir, $url_array->[0],
[16392]379 $block_hash, $metadata, $processor, $maxdocs,
380 $total_count, $gli);
[9958]381 }
382 else
383 {
384 # create a new document
385 my $doc_obj = new doc ($filename, "indexed_doc");
386 my $top_section = $doc_obj->get_top_section;
387 my $plugin_type = $self->{'plugin_type'};
388
389 $doc_obj->add_utf8_metadata($top_section, "Language", $language);
390 $doc_obj->add_utf8_metadata($top_section, "Encoding", $encoding);
391 $doc_obj->add_utf8_metadata($top_section, "Plugin", $plugin_type);
392 $doc_obj->add_metadata($top_section, "FileFormat", "OAI");
393 $doc_obj->add_metadata($top_section, "FileSize", (-s $filename));
394
395 # include any metadata passed in from previous plugins
396 # note that this metadata is associated with the top level section
397 $self->extra_metadata ($doc_obj, $doc_obj->get_top_section(), $metadata);
398
399 # do plugin specific processing of doc_obj
400 my $textref = \$self->{'rawxml'};
401 unless (defined ($self->process($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj))) {
402 print STDERR "<ProcessingError n='$file'>\n" if ($gli);
403 return -1;
404 }
405
406 # do any automatic metadata extraction
407 $self->auto_extract_metadata ($doc_obj);
408
409 # add an OID
[17026]410 $self->add_OID($doc_obj);
[9958]411
412 my $ppmd_table = $self->{'ppmd_table'};
413 $doc_obj->add_utf8_metadata($top_section,"prettymd",$ppmd_table);
414 $self->{'ppmd_table'} = undef;
415
416 # process the document
417 $processor->process($doc_obj);
418
419 $self->{'num_processed'} ++;
420
421 return 1; # processed the file
422 }
[4726]423 }
[9958]424 else {
425 return undef;
426 }
[4726]427}
428
429
430# do plugin specific processing of doc_obj
431sub process {
432 my $self = shift (@_);
[6332]433 my ($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
[4726]434 my $outhandle = $self->{'outhandle'};
435
[15872]436 print STDERR "<Processing n='$file' p='OAIPlugin'>\n" if ($gli);
437 print $outhandle "OAIPlugin: processing $file\n"
[4726]438 if $self->{'verbosity'} > 1;
439
440 my $cursection = $doc_obj->get_top_section();
441
442## $self->extract_metadata ($textref, $metadata, $doc_obj, $cursection);
443
444 # add text to document object
445
446# $$textref =~ s/<(.*?)>/$1 /g;
447 $$textref =~ s/</&lt;/g;
448 $$textref =~ s/>/&gt;/g;
[14963]449 $$textref =~ s/\[/&#91;/g;
450 $$textref =~ s/\]/&#93;/g;
[4726]451
452## print STDERR "*** adding text: $$textref\n";
453
454 $doc_obj->add_utf8_text($cursection, $$textref);
455
456 return 1;
457}
458
459
[9958]460# Improvement is to merge this with newer version in MetadataPass
[4726]461
[9958]462sub open_prettyprint_metadata_table
463{
464 my $self = shift(@_);
465
466 my $att = "width=100% cellspacing=2";
467 my $style = "style=\'border-bottom: 4px solid #000080\'";
468
[17290]469 $self->{'ppmd_table'} = "\n<table $att $style>";
[9958]470}
471
472sub add_prettyprint_metadata_line
473{
474 my $self = shift(@_);
475 my ($metaname, $metavalue_utf8) = @_;
476
[14949]477### $metavalue_utf8 =~ s/hdl\.handle\.net/mcgonagall.cs.waikato.ac.nz:8080\/dspace\/handle/;
[9958]478 $metavalue_utf8 = &util::hyperlink_text($metavalue_utf8);
479
480 $self->{'ppmd_table'} .= " <tr bgcolor=#b5d3cd>\n";
481 $self->{'ppmd_table'} .= " <td width=30%>\n";
482 $self->{'ppmd_table'} .= " $metaname\n";
483 $self->{'ppmd_table'} .= " </td>\n";
484 $self->{'ppmd_table'} .= " <td>\n";
485 $self->{'ppmd_table'} .= " $metavalue_utf8\n";
486 $self->{'ppmd_table'} .= " </td>\n";
487 $self->{'ppmd_table'} .= " </tr>\n";
488
489}
490
491sub close_prettyprint_metadata_table
492{
493 my $self = shift(@_);
494
495 $self->{'ppmd_table'} .= "</table>\n";
496}
497
498
[14940]499sub remap_dcterms_metadata
500{
501 my $self = shift(@_);
[9958]502
[14940]503 my ($metaname) = @_;
[9958]504
[14940]505 my $dcterm_mapping = {
506 "alternative" => "dc.title",
507 "tableOfContents" => "dc.description",
508 "abstract" => "dc.description",
509 "created" => "dc.date",
510 "valid" => "dc.date",
511 "available" => "dc.date",
512 "issued" => "dc.date",
513 "modified" => "dc.date",
514 "dateAccepted" => "dc.date",
515 "dateCopyrighted" => "dc.date",
516 "dateSubmitted" => "dc.date",
517 "extent" => "dc.format",
518 "medium" => "dc.format",
519 "isVersionOf" => "dc.relation",
520 "hasVersion" => "dc.relation",
521 "isReplacedBy" => "dc.relation",
522 "replaces" => "dc.relation",
523 "isRequiredBy" => "dc.relation",
524 "requires" => "dc.relation",
525 "isPartOf" => "dc.relation",
526 "hasPart" => "dc.relation",
527 "isReferencedBy" => "dc.relation",
528 "references" => "dc.relation",
529 "isFormatOf" => "dc.relation",
530 "hasFormat" => "dc.relation",
531 "conformsTo" => "dc.relation",
532 "spatial" => "dc.coverage",
533 "temporal" => "dc.coverage",
534 "audience" => "dc.any",
535 "accrualMethod" => "dc.any",
536 "accrualPeriodicity" => "dc.any",
537 "accrualPolicy" => "dc.any",
538 "instructionalMethod" => "dc.any",
539 "provenance" => "dc.any",
540 "rightsHolder" => "dc.any",
541 "mediator" => "audience",
542 "educationLevel" => "audience",
543 "accessRights" => "dc.rights",
544 "license" => "dc.rights",
545 "bibliographicCitation" => "dc.identifier"
546 };
547
548 my ($prefix,$name) = ($metaname =~ m/^(.*?)\.(.*?)$/);
549
550 if ($prefix eq "dcterms")
551 {
552 if (defined $dcterm_mapping->{$name})
553 {
554 return $dcterm_mapping->{$name}."^".$name;
555 }
556
557 }
558 return $metaname; # didn't get a match, return param passed in unchanged
559}
560
561
[4726]562sub extract_oai_metadata {
563 my $self = shift (@_);
564 my ($textref, $metadata) = @_;
565 my $outhandle = $self->{'outhandle'};
566
[9958]567 # Only handles DC metadata
568
569 $self->open_prettyprint_metadata_table();
570
571 if ($$textref =~ m/<metadata\s*>(.*?)<\/metadata\s*>/s)
[4726]572 {
[10254]573 my $metadata_text = $1;
[4726]574
[14940]575 # locate and remove outermost tag (ignoring any attribute information in top-level tag)
576 my ($wrapper_metadata_xml,$inner_metadata_text) = ($metadata_text =~ m/<([^ >]+).*?>(.*?)<\/\1>/s);
577
578 # split tag into namespace and tag name
579 my($namespace,$top_level_prefix) = ($wrapper_metadata_xml =~ m/^(.*?):(.*?)$/);
580
[17066]581 # sometimes, the dc namespace is not specified as the prefix in each element (like <dc:title>)
582 # but is rather defined in the wrapper element containing the various dc meta elements,
583 # like <dc><title></title><creator></creator></dc>.
584 # In such a case, we use this wrapper element as the top_level_prefix
585 if(!defined $top_level_prefix && defined $wrapper_metadata_xml && $wrapper_metadata_xml =~ m/dc$/) {
586 $top_level_prefix = $wrapper_metadata_xml;
587 }
588
589 if ($top_level_prefix !~ m/dc$/) {
[15872]590 print $outhandle "Warning: OAIPlugin currently only designed for Dublin Core (or variant) metadata\n";
[14940]591 print $outhandle " This recorded metadata section '$top_level_prefix' does not appear to match.\n";
592 print $outhandle " Metadata assumed to be in form: <prefix:tag>value</prefix:tag> and will be converted\n";
593 print $outhandle " into Greenstone metadata as prefix.tag = value\n";
594 }
595
[14949]596 while ($inner_metadata_text =~ m/<([^ >]+).*?>(.*?)<\/\1>(.*)/s)
[4726]597 {
598 # if URL given for document as identifier metadata, store it ...
599 # $doc_obj->add_utf8_metadata($cursection, "URL", $web_url);
[9958]600
[4726]601 my $metaname = $1;
602 my $metavalue = $2;
[14949]603 $inner_metadata_text = $3;
604
605# print STDERR "*** metaname = $metaname\n";
606# print STDERR "*** metavalue = $metavalue\n";
607
[14940]608 # $metaname =~ s/^(dc:)?(.)/\u$2/; # strip of optional prefix and uppercase first letter
609 $metaname =~ s/:/\./;
610 if ($metaname !~ m/\./)
[4726]611 {
[14940]612 $metaname = "$top_level_prefix.$metaname";
[17066]613# print STDERR "*** metaname = $metaname\tmetavalue = $metavalue\n";
[4726]614 }
[14963]615 $metaname =~ s/\.(.)/\.\u$1/;
[4726]616
[14940]617 $metaname = $self->remap_dcterms_metadata($metaname);
618
[14963]619 $metavalue =~ s/\[/&#91;/g;
620 $metavalue =~ s/\]/&#93;/g;
621
622
[14940]623# if ($metaname eq "Identifier")
624# {
625# # name clashes with GSDL reserved metadata name for hash id
626# $metaname = "URL";
627# }
628
[4726]629 if (defined $metadata->{$metaname})
630 {
631 push(@{$metadata->{$metaname}},$metavalue);
[8121]632
[4726]633 }
634 else
635 {
636 $metadata->{$metaname} = [ $metavalue ];
637 }
638
[9958]639 $self->add_prettyprint_metadata_line($metaname, $metavalue);
640
[4726]641 }
642 }
[9958]643
644 $self->close_prettyprint_metadata_table();
[4726]645}
646
[13886]647## we know from the file extension, so doesn't need to check the doctype
648sub check_doctype {
649
650 return 1;
651}
652
[4726]6531;
Note: See TracBrowser for help on using the repository browser.