Changeset 12430


Ignore:
Timestamp:
2006-08-11T11:33:26+12:00 (18 years ago)
Author:
mdewsnip
Message:

Now handles hyperlinks in RTF properly.

File:
1 edited

Legend:

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

    r12396 r12430  
    982982    # Convert the place references from RTF to HTML
    983983    my $place_references_html_string = &rtf_to_html($place_references_rtf_string);
     984    if ($place_references_html_string =~ / (http|www\.)/) {
     985    print STDERR "<ProcessingError n='Place $place_id' p='CICPlug' r='Warning: Found possible web address in references without hyperlink tag.'>\n" if ($self->{'gli'});
     986    print STDERR "Warning: Place $place_id -- Found possible web address in references without hyperlink tag.\n";
     987    print $fail_log_handle "Warning: Place $place_id -- Found possible web address in references without hyperlink tag.\n";
     988    }
    984989    &new_metadata_entry($place_doc_obj, "PlaceReferences", $place_references_html_string);
    985990
     
    10131018{
    10141019    my $rtf_string = shift(@_);
    1015     $rtf_string =~ s/\{(.*?)\}//g;
     1020 
     1021    # Remove everything in curly braces, but keep any hyperlinks
     1022    while ($rtf_string =~ /\{(.*?)\}/) {
     1023    if ($1 =~ /HYPERLINK (.*)/) {
     1024        my $link_url = $1;
     1025        $link_url =~ s/^\"(.*?)\"$/$1/;  # Remove surrounding quotes
     1026        $link_url =~ s/^\s*(.*?)\s*$/$1/;  # Remove surrounding whitespace
     1027        $rtf_string =~ s/\{(.*?)\}/<a href=\"$link_url\">$link_url<\/a>/;
     1028    }
     1029    else {
     1030        $rtf_string =~ s/\{(.*?)\}//;
     1031    }
     1032    }
    10161033    $rtf_string =~ s/\\ldblquote /"/g;
    10171034    $rtf_string =~ s/\\rdblquote /"/g;
Note: See TracChangeset for help on using the changeset viewer.