File Coverage

blib/lib/Spork/S5.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package Spork::S5;
2 1     1   1284 use Spork::Plugin -Base;
  0            
  0            
3             our $VERSION = '0.05';
4              
5             const class_id => 's5';
6              
7             sub register {
8             my $r = shift;
9             $r->add(hook => 'slides:make_slides', pre => 'slides_hook');
10             }
11              
12             sub slides_hook {
13             my $hook = pop;
14             $self->hub->s5->make_s5_slides;
15             $hook->cancel;
16             }
17              
18             sub make_s5_slides {
19             $self->hub->template->add_path(
20             $self->config->slides_directory.'/template/s5'
21             );
22             my @allcontent;
23             my @slides = $self->hub->slides->split_slides($self->config->slides_file);
24             for (my $i = 0; $i < @slides; $i++) {
25             my $slide = $slides[$i];
26             $self->config->add_config($slide->{config});
27             my $content = $slides[$i]{slide_content};
28             $self->hub->slides->image_url('');
29             my $parsed = $self->formatter->text_to_parsed($content);
30             my $html = $parsed->to_html;
31             $slide->{image_html} = $self->hub->slides->get_image_html;
32             my $output = $self->template->process('slide.html',
33             %$slide,
34             hub => $self->hub,
35             slide_content => $html,
36             );
37             push @allcontent,$output;
38             }
39             my $output = $self->template->process(
40             's5.html',
41             hub => $self->hub,
42             slides => \@allcontent,
43             );
44             io->catfile($self->config->slides_directory,'start.html')
45             ->assert->print($output);
46             }
47              
48             __DATA__