Changeset 10275 for trunk/gsdl/perllib/plugins/PPTPlug.pm
- Timestamp:
- 2005-07-25T13:52:52+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugins/PPTPlug.pm
r10254 r10275 41 41 'type' => "regexp", 42 42 'reqd' => "no", 43 'deft' => &get_default_process_exp() },43 'deft' => &get_default_process_exp()} 44 44 ]; 45 45 … … 55 55 push(@$pluginlist, $class); 56 56 57 if ($ENV{'GSDLOS'} =~ m/^windows$/i) { 58 my $ws_arg = { 'name' => "windows_scripting", 59 'desc' => "PPTPlug.windows_scripting}", 60 'type' => "flag", 61 'reqd' => "no" }; 62 push(@$arguments,$ws_arg); 63 } 64 57 65 if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});} 58 66 if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)}; 59 67 60 68 my $self = (defined $hashArgOptLists)? new ConvertToPlug($pluginlist,$inputargs,$hashArgOptLists): new ConvertToPlug($pluginlist,$inputargs); 69 70 # ppthtml outputs utf-8 already. 71 #these are passed through to gsConvert.pl by ConvertToPlug.pm 72 $self->{'convert_options'} = "-windows_scripting" if $self->{'window_scripting'}; 73 my $secondary_plugin_options = $self->{'secondary_plugin_options'}; 61 74 62 # ppthtml outputs utf-8 already. 75 if ($self->{'windows_scripting'} && ($self->{'convert_to'} eq "PagedImg")) { 76 $secondary_plugin_options->{'PagedImgPlug'} = []; 77 } else { 78 $secondary_plugin_options->{'HTMLPlug'} = []; 79 } 80 my $html_options = $secondary_plugin_options->{'HTMLPlug'}; 81 my $pageimg_options = $secondary_plugin_options->{'PagedImgPlug'}; 82 63 83 if ($self->{'input_encoding'} eq "auto") { 64 84 $self->{'input_encoding'} = "utf8"; 85 $self->{'extract_language'} = 1; 86 if (defined $secondary_plugin_options->{'HTMLPlug'}){ 87 push(@$html_options,"-input_encoding", "utf8"); 88 push(@$html_options,"-extract_language"); 89 90 # Instruct HTMLPlug (when eventually accessed through read_into_doc_obj) 91 # to extract these metadata fields from the HEAD META fields 92 push(@$html_options,"-metadata_fields","Title,GENERATOR,date,author<Creator>"); 93 #push(@$html_options , "-title_sub", '^(Page\s+\d+)?(\s*1\s+)?'); 94 } 95 if (defined $secondary_plugin_options->{'PagedImgPlug'}){ 96 push(@$pageimg_options,"-input_encoding", "utf8"); 97 push(@$pageimg_options,"-extract_language"); 98 } 65 99 } 66 100 67 return bless $self, $class; 101 $self = bless $self, $class; 102 103 $self->load_secondary_plugins($class,$secondary_plugin_options); 104 return $self; 68 105 } 69 106 … … 72 109 return q^(?i)\.ppt$^; 73 110 } 74 111 112 sub get_file_type { 113 my $self = shift (@_); 114 my $file_type = "PPT"; 115 return $file_type; 116 } 117 118 sub convert_post_process 119 { 120 my $self = shift (@_); 121 my ($conv_filename) = @_; 122 123 my $outhandle=$self->{'outhandle'}; 124 my ($language, $encoding) = $self->textcat_get_language_encoding ($conv_filename); 125 # read in file ($text will be in utf8) 126 my $text = ""; 127 $self->read_file ($conv_filename, $encoding, $language, \$text); 128 129 # turn any high bytes that aren't valid utf-8 into utf-8. 130 unicode::ensure_utf8(\$text); 131 # Write it out again! 132 $self->utf8_write_file (\$text, $conv_filename); 133 } 134 75 135 sub process { 76 136 my $self = shift (@_); 137 my ($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_; 77 138 78 my $outhandle = $self->{'outhandle'}; 79 print $outhandle "PPTPlug: passing $_[3] on to $self->{'converted_to'}Plug\n" 80 if $self->{'verbosity'} > 1; 81 print STDERR "<Processing n='$_[3]' p='PPTPlug'>\n" if ($_[6]); 82 83 return ConvertToPlug::process_type($self,"ppt",@_); 139 return $self->process_type("ppt",$base_dir,$file,$doc_obj); 84 140 } 85 141 86 142 1; 143
Note:
See TracChangeset
for help on using the changeset viewer.