Changeset 8914


Ignore:
Timestamp:
2005-01-20T10:13:30+13:00 (19 years ago)
Author:
chi
Message:

Add a smart_block option to deal with associated files of HTML document.

File:
1 edited

Legend:

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

    r8843 r8914  
    3333# (it's removed by this plugin)
    3434#
    35 
    3635
    3736package HTMLPlug;
     
    144143sub get_default_block_exp {
    145144    my $self = shift (@_);
    146 
     145   
    147146    return q^(?i)\.(gif|jpe?g|jpe|jpg|png|css)$^;
    148147}
     
    150149sub get_default_process_exp {
    151150    my $self = shift (@_);
    152 
     151   
    153152    # the last option is an attempt to encode the concept of an html query ...
    154153    return q^(?i)(\.html?|\.shtml|\.shm|\.asp|\.php\d?|\.cgi|.+\?.+=.*)$^;
    155154}
     155
    156156
    157157sub metadata_read {
     
    170170    }
    171171
    172     # Do encoding stuff
    173     my ($language, $encoding) = $self->textcat_get_language_encoding ($filename);
     172    if ($self->{'smart_block'}) {
     173       # Do encoding stuff
     174       my ($language, $encoding) = $self->textcat_get_language_encoding ($filename);
    174175   
    175     # read in file ($text will be in utf8)
    176     my $text = "";
    177     $self->read_file ($filename, $encoding, $language, \$text);
    178 
    179     $self->store_block_files (\$text, $filename);
    180    
     176       # read in file ($text will be in utf8)
     177       my $text = "";
     178       $self->read_file ($filename, $encoding, $language, \$text);
     179       $self->store_block_files (\$text, $filename);
     180   }
    181181    return 1;
    182182}
     
    463463    my ($filename) = $href =~ /^(?:.*?):(?:\/\/)?(.*)/;
    464464   
     465
    465466    ##### leave all these links alone (they won't be picked up by intermediate
    466467    ##### pages). I think that's safest when dealing with frames, targets etc.
     
    609610        $before_hash .= "/" if (-d $linkfilename);
    610611    }
    611    
    612612    return ("http://" . $before_hash, $hash_part, 1);
    613613    } else {
Note: See TracChangeset for help on using the changeset viewer.