Changeset 965
- Timestamp:
- 2000-02-23T09:46:16+13:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugins/HTMLPlug.pm
r900 r965 71 71 print STDERR " -w3mir Set if w3mir was used to generate input file structure.\n"; 72 72 print STDERR " w3mir \n"; 73 print STDERR " -assoc_files Perl regular expression of file extensions to associate with\n"; 74 print STDERR " html documents. Defaults to '(?i)\.(jpe?g|gif|png|css|pdf)$'\n"; 73 75 print STDERR " -rename_assoc_files Renames files associated with documents (e.g. images). Also\n"; 74 76 print STDERR " creates much shallower directory structure (useful when creating\n"; … … 88 90 q^metadata_fields/.*/Title^, \$self->{'metadata_fields'}, 89 91 q^w3mir^, \$self->{'w3mir'}, 92 q^assoc_files/.*/(?i)\.(jpe?g|gif|png|css|pdf)$^, \$self->{'assoc_files'}, 90 93 q^rename_assoc_files^, \$self->{'rename_assoc_files'})) { 91 94 &print_usage(); … … 134 137 $/ = "\n"; 135 138 close FILE; 136 if ( $text !~ /\w/) {139 if (!defined $text || $text !~ /\w/) { 137 140 print STDERR "HTMLPlug: ERROR: $file contains no text\n" if $self->{'verbosity'}; 138 141 return 0; … … 191 194 192 195 my ($href, $hash_part, $rl) = $self->format_link ($link, $base_dir, $file); 193 return $front . $self->add_file ($href, $ base_dir, $doc_obj, $section) . $back;196 return $front . $self->add_file ($href, $rl, $hash_part, $base_dir, $doc_obj, $section) . $back; 194 197 } 195 198 … … 234 237 # link is to some other type of file (image, pdf etc.) so we'll 235 238 # need to associate that file 236 return $front . $self->add_file ($href, $ base_dir, $doc_obj, $section) . $back;239 return $front . $self->add_file ($href, $rl, $hash_part, $base_dir, $doc_obj, $section) . $back; 237 240 } 238 241 } … … 240 243 sub add_file { 241 244 my $self = shift (@_); 242 my ($href, $ base_dir, $doc_obj, $section) = @_;245 my ($href, $rl, $hash_part, $base_dir, $doc_obj, $section) = @_; 243 246 my ($newname); 244 247 … … 247 250 $filename = &util::filename_cat ($base_dir, $filename); 248 251 my ($ext) = $filename =~ /(\.[^\.]*)$/; 252 253 if ((!defined $ext) || ($ext !~ /$self->{'assoc_files'}/)) { 254 return "_httpextlink_&rl=" . $rl . "&href=" . $href . $hash_part; 255 } 256 249 257 if ($self->{'rename_assoc_files'}) { 250 258 if (defined $self->{'aux_files'}->{$href}) { … … 253 261 } else { 254 262 $newname = $self->{'dir_num'} . "/" . $self->{'file_num'} . $ext; 263 $self->{'aux_files'}->{$href} = {'dir_num' => $self->{'dir_num'}, 'file_num' => $self->{'file_num'}}; 255 264 $self->inc_filecount (); 256 265 }
Note:
See TracChangeset
for help on using the changeset viewer.