line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SWISH::Filters::Doc2html; |
2
|
1
|
|
|
1
|
|
526
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
3
|
1
|
|
|
1
|
|
4
|
use vars qw( $VERSION @ISA ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
216
|
|
4
|
|
|
|
|
|
|
$VERSION = '0.191'; |
5
|
|
|
|
|
|
|
@ISA = ('SWISH::Filters::Base'); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
1
|
|
|
1
|
0
|
28
|
my ($class) = @_; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
|
|
6
|
my $self = bless { mimetypes => [qr!application/(x-)?msword!], }, $class; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
|
|
7
|
return $self->set_programs('wvWare'); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub filter { |
16
|
0
|
|
|
0
|
1
|
|
my ( $self, $doc ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Grab output from running program |
19
|
0
|
|
0
|
|
|
|
my $content = $self->run_wvWare( "-1", $doc->fetch_filename ) || return; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
0
|
|
|
|
my $meta = $doc->meta_data || {}; |
22
|
0
|
|
|
|
|
|
my $headers = $self->format_meta_headers($meta); |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
|
if ( $content =~ m//i ) { |
25
|
0
|
|
|
|
|
|
$content =~ s//$headers/i; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
else { |
28
|
0
|
|
|
|
|
|
$content =~ s//$headers\n/i; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# update the document's content type |
32
|
0
|
|
|
|
|
|
$doc->set_content_type('text/html'); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# return the document |
35
|
0
|
|
|
|
|
|
return ( \$content, $meta ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |