blib/lib/DTL/Fast/Filter/Linebreaks.pm

filter: Statementstmt 100% 24 / 24 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 93.7% 30 / 32 SCAR 6.9
CC
2
Cov
96%
filter
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« blib/lib/DTL/Fast/Filter/Numberformat.pm ↑ Summary blib/lib/DTL/Fast/Tag/If/Condition.pm »
1 package DTL::Fast::Filter::Linebreaks;
2 2 ▶use strict; use utf8; use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use parent 'DTL::Fast::Filter';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 $DTL::Fast::FILTER_HANDLERS{'linebreaks'} = __PACKAGE__;
6  
7 #@Override
8 sub filter
9 {
10 1 ▶ shift; # self
Subroutine filter: called CC=2 SCAR=6.9
Pod undocumented
11 1 my $filter_manager = shift; # filter_manager
12 1 my $value = shift; # value
13 1 shift; # context
14  
15 1 $filter_manager->{'safe'} = 1;
16 1 $value =~ s/(^\s+|\s+$)//gs;
17 1 $value =~ s/\n\n+/<\/p>\n<p>/gs;
18 1 $value =~ s/(?<!<\/p>)\n/<br \/>\n/gsi;
19 1 ▶ $value = "<p>$value</p>" if $value;
Branch: 1 branch
BranchTrueFalseTotal
if $value 1 0 1
20
21 1 return $value;
22 }
23  
24 2 1;
« blib/lib/DTL/Fast/Filter/Numberformat.pm ↑ Summary blib/lib/DTL/Fast/Tag/If/Condition.pm »