Changeset 9067
- Timestamp:
- 2005-02-16T16:26:34+13:00 (19 years ago)
- Location:
- trunk/gsdl/perllib/plugins
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugins/BasPlug.pm
r8915 r9067 69 69 'type' => "regexp", 70 70 'deft' => "", 71 'reqd' => "no" }, 72 { 'name' => "smart_block", 73 'desc' => "{BasPlug.smart_block}", 74 'type' => "flag", 71 75 'reqd' => "no" }, 72 76 { 'name' => "associate_ext", … … 428 432 } 429 433 434 # default implementation is to do nothing. 435 sub store_block_files 436 { 437 my $self =shift (@_); 438 my ($filename) = @_; 439 return; 440 } 441 442 #default implementation is to block a file with same name as this, but extension jpg or JPG, if cover_images is on. 443 sub block_cover_image 444 { 445 my $self =shift (@_); 446 my ($filename) = @_; 447 if ($self->{'cover_image'}) { 448 my $coverfile = $filename; 449 $coverfile =~ s/\.[^\\\/\.]+$/\.jpg/; 450 if (!-e $coverfile) { 451 $coverfile =~ s/jpg$/JPG/; 452 } 453 if (-e $coverfile) { 454 $self->{'file_blocks'}->{$coverfile} = 1; 455 } 456 } 457 458 return; 459 } 460 430 461 sub metadata_read { 431 462 my $self = shift (@_); 432 463 my ($pluginfo, $base_dir, $file, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_; 433 434 464 # Keep track of filenames with same root but different extensions 435 # Used to support -asso icate_ext465 # Used to support -associate_ext 436 466 437 467 my $associate_ext = $self->{'associate_ext'}; … … 460 490 } 461 491 } 462 463 return undef; 492 493 # now check whether we are actually processing this 494 my $filename = $file; 495 $filename = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/; 496 if ($self->{'process_exp'} eq "" || $filename !~ /$self->{'process_exp'}/ || !-f $filename) { 497 return undef; # can't recognise 498 } 499 500 # do smart blocking if appropriate 501 if (defined $self->{'smart_block'}) { 502 $self->block_cover_image($filename); 503 $self->store_block_files($filename); 504 } 505 506 return 1; 464 507 } 465 508 -
trunk/gsdl/perllib/plugins/ConvertToPlug.pm
r9046 r9067 151 151 152 152 # Go straight to BasPlug and avoid the special case implemented by HTMLPlug 153 sub metadata_read{154 return BasPlug:: metadata_read(@_);153 sub store_block_files { 154 return BasPlug::store_block_files(@_); 155 155 } 156 156 -
trunk/gsdl/perllib/plugins/HTMLPlug.pm
r9057 r9067 91 91 { 'name' => "description_tags", 92 92 'desc' => "{HTMLPlug.description_tags}", 93 'type' => "flag" } 93 'type' => "flag" }, 94 94 { 'name' => "no_strip_metadata_html", 95 95 'desc' => "{HTMLPlug.no_strip_metadata_html}", … … 161 161 } 162 162 163 164 sub metadata_read {165 my $self = shift (@_);166 my ($pluginfo, $base_dir, $file, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;167 168 my $outhandle = $self->{'outhandle'};169 170 my $filename = $file;171 $filename = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/;172 173 my ($dir) = $filename =~ /^(.*?)[^\/\\]*$/;174 175 if ($filename !~ /$self->{'process_exp'}/ || !-f $filename) {176 return undef; # can't recognise177 }178 179 if ($self->{'smart_block'}) {180 # Do encoding stuff181 my ($language, $encoding) = $self->textcat_get_language_encoding ($filename);182 183 # read in file ($text will be in utf8)184 my $text = "";185 $self->read_file ($filename, $encoding, $language, \$text);186 $self->store_block_files (\$text, $filename);187 }188 return 1;189 }190 191 163 sub store_block_files 192 164 { 193 165 my $self =shift (@_); 194 my ($textref, $filename) = @_; 195 166 my ($filename) = @_; 196 167 my $html_fname = $filename; 197 168 my @file_blocks; 198 169 170 my ($language, $encoding) = $self->textcat_get_language_encoding ($filename); 171 172 # read in file ($text will be in utf8) 173 my $text = ""; 174 $self->read_file ($filename, $encoding, $language, \$text); 175 my $textref = \$text; 199 176 my $opencom = '(?:<!--|<!(?:—|—|--))'; 200 177 my $closecom = '(?:-->|(?:—|—|--)>)'; … … 226 203 } 227 204 } 205 228 206 229 207 # do plugin specific processing of doc_obj … … 312 290 # were probably introduced when converting to HTML from 313 291 # some other format). 314 # actually some people want to have html tags in their 292 # actually some people want to have html tags in their 315 293 # metadata. 316 294 $metavalue =~ s/[\cJ\cM]/ /sg; -
trunk/gsdl/perllib/plugins/ImagePlug.pm
r8365 r9067 122 122 } 123 123 124 124 # this makes no sense for images 125 sub block_cover_image 126 { 127 my $self =shift (@_); 128 my ($filename) = @_; 129 130 return; 131 } 125 132 # Create the thumbnail and screenview images, and discover the Image's 126 133 # size, width, and height using the convert utility.
Note:
See TracChangeset
for help on using the changeset viewer.