File Coverage

blib/lib/SWISH/Filters/pp2html.pm
Criterion Covered Total %
statement 9 23 39.1
branch 0 2 0.0
condition 0 4 0.0
subroutine 3 4 75.0
pod 1 2 50.0
total 13 35 37.1


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<title>/i; </td> </tr> <tr> <td class="h" > <a name="35">35</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="36">36</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="37">37</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> # update the document's content type </td> </tr> <tr> <td class="h" > <a name="38">38</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $doc->set_content_type('text/html'); </td> </tr> <tr> <td class="h" > <a name="39">39</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="40">40</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return ( \$content, $meta ); </td> </tr> <tr> <td class="h" > <a name="41">41</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="42">42</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="43">43</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> 1; </td> </tr> <tr> <td class="h" > <a name="44">44</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> __END__ </td> </tr> </table> </body> </html>