File Coverage

lib/Kwiki/PodBlocks.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 Kwiki::PodBlocks;
2 1     1   86117 use Kwiki::Plugin -Base;
  0            
  0            
3             use Kwiki::Installer -base;
4             our $VERSION = '0.11';
5              
6             const class_id => 'pod_blocks';
7             const css_file => 'pod_blocks.css';
8              
9             sub register {
10             my $registry = shift;
11             $registry->add(wafl => pod => 'Kwiki::PodBlocks::Wafl');
12             }
13              
14             package Kwiki::PodBlocks::Wafl;
15             use base 'Spoon::Formatter::WaflBlock';
16              
17             sub to_html {
18             return join '',
19             qq{
\n},
20             $self->pod2html($self->units->[0]),
21             qq{\n};
22             }
23              
24             sub pod2html {
25             require Pod::Simple::HTML;
26             my $source = shift;
27             my $result;
28             my $parser = Pod::Simple::HTML->new;
29             $parser->output_string(\$result);
30             eval {
31             $parser->parse_string_document($source);
32             };
33             $result = $source if $@;
34             $result =~ s/.*(.*)<\/body>.*/$1/s;
35             return $result;
36             }
37              
38             package Kwiki::PodBlocks;
39             __DATA__