lib/Kwiki/Formatter/Pod.pm

filter: Statementstmt 56.8% 29 / 51 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 72.7% 8 / 11 Podpod n/a totaltotal 47.4% 37 / 78 CC 6 SCAR 20.6
CC
6
Cov
46%
do_link
20.0
to_html
12.0
parse
2.0
CRAP 7.9
↑ Summary
1 package Kwiki::Formatter::Pod;
2 1 ▶use Spoon::Formatter -Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Kwiki::Installer -base;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 our $VERSION = '0.11';
5  
6 1 const top_class => 'Kwiki::Formatter::Pod::Top';
7 1 const class_title => 'Pod Formatter';
8  
9 package Kwiki::Formatter::Pod::Top;
10 1 ▶use base 'Spoon::Formatter::Unit';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 0 ▶sub parse {
Subroutine parse: not called CC=1 SCAR=6.9
13 0 $self->hub->css->add_file('formatter.css');
14 0 return $self;
15 }
16  
17 0 ▶sub to_html {
Subroutine to_html: not called CC=3 SCAR=24.8
18 0 require Pod::Simple::HTML;
19 0 my $source = $self->text;
20 0 my $result;
21 0 my $parser = Kwiki::Formatter::Pod::Simple::HTML->new;
22 0 $parser->kwiki_hub($self->hub);
23 0 $parser->output_string(\$result);
24 0 eval {
25 0 $parser->parse_string_document($source);
26 };
27 0 ▶ return "<pre>\n$source\n$@\n</pre>\n"
Branch: 1 branch
BranchTrueFalseTotal
if $@ or not $result 0 0 0
Condition0%0/3
$@ or not $result
l!l&&r!l&&!r
000
MC/DC0%0/2
$@ or not $result
$@ not $result
Truth table0%0/3
A or not(B)
A= $@B= not $result
ABresult
1X1
011
000
28 if $@ or not $result;
29 0 $result =~ s/.*<body.*?>(.*)<\/body>.*/$1/s;
30 0 return qq{<div class="formatter_pod">\n$result</div>};
31 }
32  
33 package Kwiki::Formatter::Pod::Simple::HTML;
34 1 ▶use base 'Pod::Simple::HTML';
Subroutine BEGIN: called CC=1 SCAR=0.0
35 1 ▶use base 'Kwiki::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
36 1 ▶use Kwiki ':char_classes';
Subroutine BEGIN: called CC=1 SCAR=0.0
37  
38 1 field 'kwiki_hub';
39  
40 0 ▶sub do_link {
Subroutine do_link: not called CC=4 SCAR=30.0
41 0 my $token = shift;
42 0 my $link = $token->attr('to');
43 0 ▶ return super unless $link =~ /^[$WORD]+$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $link =~ /^[$Kwiki::Formatter::Pod::Simple::HTML::WORD]+$/ 0 0 0
44 0 my $section = $token->attr('section');
45 0 ▶ $section = "#$section"
Branch: 1 branch
BranchTrueFalseTotal
if defined $section and length $section 0 0 0
Condition0%0/3
defined $section and length $section
!ll&&!rl&&r
000
MC/DC0%0/2
defined $section and length $section
defined $section length $section
Truth table0%0/3
A and B
A= defined $sectionB= length $section
ABresult
0X0
100
111
46 if defined $section and length $section;
47 0 $self->kwiki_hub->config->script_name . "?$link$section";
48 }
49  
50 package Kwiki::Formatter::Pod;
51 1 __DATA__
↑ Summary