Changeset 2450 for trunk/gsdl/perllib/plugins/TEXTPlug.pm
- Timestamp:
- 2001-05-21T18:00:29+12:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugins/TEXTPlug.pm
r2219 r2450 30 30 31 31 use BasPlug; 32 use parsargv; 33 32 34 33 35 sub BEGIN { … … 35 37 } 36 38 39 sub print_usage { 40 print STDERR "\n usage: plugin TEXTPlug [options]\n\n"; 41 print STDERR " options:\n"; 42 print STDERR " -title_sub\t Substitution expression to modify string stored as Title.\n"; 43 print STDERR "\t\t Used by, for example, PSPlug to remove \"Page 1\" etc from\n"; 44 print STDERR "\t\t text used as the title.\n"; 45 46 print STDERR "\n"; 47 } 48 37 49 sub new { 38 50 my ($class) = @_; 39 51 my $self = new BasPlug ($class, @_); 52 53 if (!parsargv::parse(\@_, 54 q^title_sub/.*/^, \$self->{'title_sub'}, 55 "allow_extra_options")) { 56 print STDERR "\nIncorrect options passed to TEXTPlug, check your collect.cfg configuration file\n"; 57 &print_usage(); 58 die "\n"; 59 } 60 40 61 41 62 return bless $self, $class; … … 63 84 # in from another plugin) 64 85 if (!defined $metadata->{'Title'}) { 65 my ($title) = $$textref =~ /^\s*([^\n]*)/; 86 my ($title) = $$textref; 87 $title =~ /^\s+/s; 88 if (defined $self->{'title_sub'}) {$title =~ s/$self->{'title_sub'}//;} 89 $title =~ /^\s*([^\n]*)/s; $title=$1; 66 90 if (length($title) > 100) { 67 $title = substr ($title, 0, 100) ;91 $title = substr ($title, 0, 100) . "..."; 68 92 } 69 93 $doc_obj->add_utf8_metadata ($cursection, "Title", $title);
Note:
See TracChangeset
for help on using the changeset viewer.