Ignore:
Timestamp:
1999-10-20T17:23:48+13:00 (25 years ago)
Author:
sjboddie
Message:

prevent from overriding Title metadata that may have been passed
in from another plugin (e.g. IndexPlug)

File:
1 edited

Legend:

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

    r721 r732  
    263263    $text =~ s/\s+/ /g;
    264264
    265     # see if there's a <title> tag
    266265    my $foundtitle = 0;
    267     if ($text =~ /<title[^>]*>([^<]*)<\/title[^>]*>/i) {
    268     if (defined $1) {
    269         my $title = $1;
    270         if ($title =~ /\w/) {
    271         $doc_obj->add_metadata ($cursection, "Title", $title);
    272         $foundtitle = 1;
     266    # don't use title tag if Title has been passed
     267    # in from another plugin
     268    if (defined $metadata->{'Title'}) {
     269    $foundtitle = 1;
     270    }
     271    if (!$foundtitle) {
     272    # see if there's a <title> tag
     273    if ($text =~ /<title[^>]*>([^<]*)<\/title[^>]*>/i) {
     274        if (defined $1) {
     275        my $title = $1;
     276        if ($title =~ /\w/) {
     277            $doc_obj->add_metadata ($cursection, "Title", $title);
     278            $foundtitle = 1;
     279        }
    273280        }
    274281    }
Note: See TracChangeset for help on using the changeset viewer.