Changeset 12433


Ignore:
Timestamp:
2006-08-11T13:54:05+12:00 (18 years ago)
Author:
mdewsnip
Message:

Tidied up the place references, and put each reference in a <p> tag with class "cicreference", so they can be easily formatted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cic-hcap/perllib/plugins/CICPlug.pm

    r12432 r12433  
    799799    my $place_narrative = $place_narrative_sql_handle->fetchrow();
    800800    if (defined($place_narrative)) {
    801         $place_narrative = &rtf_to_html($place_narrative);
    802         $place_narrative =~ s/<br \/>(\s|\n)*$//;  # Remove any trailing <br /> tags
    803         &new_metadata_entry($place_doc_obj, "Narrative", $place_narrative);
     801        my $place_narrative_html = &rtf_to_html($place_narrative);
     802        $place_narrative_html =~ s/<br \/>(\s|\n)*$//;  # Remove any trailing <br /> tags
     803        &new_metadata_entry($place_doc_obj, "PlaceNarrativeHTML", $place_narrative_html);
    804804    }
    805805
     
    981981
    982982    # Convert the place references from RTF to HTML
    983     my $place_references_html_string = &rtf_to_html($place_references_rtf_string);
    984     if ($place_references_html_string =~ / (http|www\.)/) {
     983    my $place_references_html_raw = &rtf_to_html($place_references_rtf_string);
     984    if ($place_references_html_raw =~ / (http|www\.)/) {
    985985    print STDERR "<ProcessingError n='Place $place_id' p='CICPlug' r='Warning: Found possible web address in references without hyperlink tag.'>\n" if ($self->{'gli'});
    986986    print STDERR "Warning: Place $place_id -- Found possible web address in references without hyperlink tag.\n";
    987987    print $fail_log_handle "Warning: Place $place_id -- Found possible web address in references without hyperlink tag.\n";
    988988    }
    989     &new_metadata_entry($place_doc_obj, "PlaceReferences", $place_references_html_string);
    990989
    991990    # Split the references and try to parse title and author
    992     $place_references_html_string =~ s/(\r|\n)//g;
    993     my @place_references = split(/<br \/><br \/>/, $place_references_html_string);
     991    my $place_references_html = "";
     992    $place_references_html_raw =~ s/(\r|\n)//g;
     993    my @place_references = split(/<br \/><br \/>/, $place_references_html_raw);
    994994    foreach my $place_reference (@place_references) {
     995    $place_reference =~ s/^(<br \/>\s*)*//;
    995996    $place_reference =~ s/(<br \/>\s*)*$//;
    996997    next if ($place_reference !~ /\w/);
    997998    &new_metadata_entry($place_doc_obj, "Reference", $place_reference);
     999    $place_references_html .= "<p class=\"cicreference\">" . $place_reference . "</p>\n";
    9981000
    9991001    # Case 0: A magic word in the first sentence
     
    10201022    }
    10211023    }
     1024
     1025    &new_metadata_entry($place_doc_obj, "PlaceReferencesHTML", $place_references_html);
    10221026}
    10231027
Note: See TracChangeset for help on using the changeset viewer.