Layout/Markdown.pm

filter: Statementstmt 36.3% 16 / 44 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 55.5% 5 / 9 Podpod 25.0% 1 / 4 totaltotal 31.4% 22 / 70 CC 7 SCAR 32.9
CC
7
Cov
29%
render
56.0
new
2.0
bbox
2.0
CRAP 26.9
« Layout/FontConfig.pm ↑ Summary Layout/Utils.pm »
1 #! perl
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 package Text::Layout::Markdown;
9  
10 1 ▶use parent 'Text::Layout';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 #### API
13 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
14 0 my ( $pkg, @data ) = @_;
15 0 my $self = $pkg->SUPER::new;
16 0 $self->{_currentfont} = { family => 'default',
17 style => 'normal',
18 weight => 'normal' };
19 0 $self->{_currentcolor} = 'black';
20 0 $self->{_currentsize} = 12;
21 0 $self;
22 }
23  
24 #### API
25 0 ▶sub render {
Subroutine render: not called CC=7 SCAR=40.3
Pod undocumented
26 0 my ( $self ) = @_;
27 0 my $res = "";
28 0 foreach my $fragment ( @{ $self->{_content} } ) {
29 0 ▶ next unless length($fragment->{text});
Branch: 1 branch
BranchTrueFalseTotal
unless length $fragment->{"text"} 0 0 0
30 0 ▶ my $f = $fragment->{font} || $self->{_currentfont};
Condition0%0/3
$fragment->{'font'} || $self->{'_currentfont'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$fragment->{'font'} || $self->{'_currentfont'}
$fragment->{'font'} $self->{'_currentfont'}
Truth table0%0/3
A || B
A= $fragment->{'font'}B= $self->{'_currentfont'}
ABresult
1X1
011
000
31 0 my $open = "";
32 0 my $close = "";
33 0 ▶ if ( $f->{style} eq "italic" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($f->{"style"} eq "italic") 0 0 0
34 0 $open = $close = "_"
35 }
36 0 ▶ if ( $f->{weight} eq "bold" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($f->{"weight"} eq "bold") 0 0 0
37 0 $open = "**$open";
38 0 $close = "$close**";
39 }
40  
41 0 ▶ if ( $res =~ /(.*)\Q$close\E$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res =~ /(.*)\Q$close\E$/) 0 0 0
42 0 $res = $1;
43 0 $open = "";
44 }
45 0 $res .= $open . $fragment->{text} . $close;
46 }
47 0 $res;
48 }
49  
50 #### API
51 0 ▶sub bbox {
Subroutine bbox: not called CC=1 SCAR=6.9
Pod undocumented
52 0 my ( $self ) = @_;
53 0 [ 0, -5, 10, 15 ]; # dummy
54 }
55  
56 #### API
57 0 ▶sub load_font {
Subroutine load_font: not called CC=1 SCAR=6.9
Pod undocumented
58 0 my ( $self, $description ) = @_;
59 0 return $description;
60 }
61  
62  
63 1 1;
« Layout/FontConfig.pm ↑ Summary Layout/Utils.pm »