line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SWISH::Filters::pp2html; |
2
|
1
|
|
|
1
|
|
764
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
3
|
1
|
|
|
1
|
|
4
|
use vars qw( $VERSION @ISA ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
346
|
|
4
|
|
|
|
|
|
|
$VERSION = '0.191'; |
5
|
|
|
|
|
|
|
@ISA = ('SWISH::Filters::Base'); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require File::Spec; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
1
|
|
|
1
|
0
|
24
|
my ($class) = @_; |
11
|
1
|
|
|
|
|
10
|
my $self = bless { mimetypes => [qr!application/vnd.ms-powerpoint!], }, |
12
|
|
|
|
|
|
|
$class; |
13
|
1
|
|
|
|
|
9
|
return $self->set_programs('ppthtml'); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub filter { |
17
|
0
|
|
|
0
|
1
|
|
my ( $self, $doc ) = @_; |
18
|
0
|
|
0
|
|
|
|
my $content = $self->run_ppthtml( $doc->fetch_filename ) || return; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# use just the file name as title with no path |
21
|
0
|
|
|
|
|
|
my ($title) = ( $content =~ m!(.*?)!io ); |
22
|
0
|
|
|
|
|
|
my ( $volume, $directories, $file ) = File::Spec->splitpath($title); |
23
|
0
|
|
0
|
|
|
|
my $meta = $doc->meta_data || {}; |
24
|
0
|
|
|
|
|
|
my $headers = $self->format_meta_headers($meta); |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
$meta->{title} = $file; |
27
|
0
|
|
|
|
|
|
$file = $self->escapeXML($file); |
28
|
0
|
|
|
|
|
|
$content =~ s,.*?,$file,i; |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
if ( $content =~ m//i ) { |
31
|
0
|
|
|
|
|
|
$content =~ s//$headers/i; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
else { |
34
|
0
|
|
|
|
|
|
$content =~ s//$headers\n/i; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# update the document's content type |
38
|
0
|
|
|
|
|
|
$doc->set_content_type('text/html'); |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
return ( \$content, $meta ); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
__END__ |