[greenstone-devel] accumulated metadata in HTMLPlug

From jens wille
DateThu, 16 Dec 2004 20:45:48 +0100
Subject [greenstone-devel] accumulated metadata in HTMLPlug
hi!

i was wondering if it could be possible to assign multiple metadata
values in HTMLPlug just as with metadata.xml's "mode=accumulate". so
i just modified HTMLPlug.pm a bit and it worked fine - as far as i
can tell.

basically, i use add_utf8_metadata instead of
set_utf8_metadata_element in process sub if we're in "merge" mode -
so i just wanted to ask if there are any objections against doing
this, i.e. replacing set_utf8_metadata_element by add_utf8_metadata.

or are there even objections against assigning multiple metadata
values in HTMLPlug at all? it's just because you didn't implement it
yet, and that just leaves me a bit doubtful ;-)

anyway, here are my changes to HTMLPlug.pm:

------------------------------- snip -------------------------------

/usr/local/gsdl/perllib/plugins> diff HTMLPlug.pm HTMLPlug.pm~
224,227c224,225
< } elsif ($tag =~ /^Metadata name=$quot(.*?)$quot(?:
mode=$quot(.*?)$quot)/s) {
< # allow multiple metadata values: mode="accumulate"
< my $metaname = $1;
< my $accumulate = $2 && $2 eq 'accumulate' ? 1 : 0;
---
> } elsif ($tag =~ /^Metadata name=$quot(.*?)$quot/s) {
> my $metaname = $1;
239,240c237
< if ($accumulate) { $doc_obj->add_utf8_metadata($cursection,
$metaname, $metavalue); }
< else { $doc_obj->set_utf8_metadata_element($cursection,
$metaname, $metavalue); }
---
> $doc_obj->set_utf8_metadata_element($cursection, $metaname,
$metavalue);

------------------------------- snip -------------------------------

regards

jens