File Coverage

blib/lib/Rubric/Entry/Formatter/Nil.pm
Criterion Covered Total %
statement 15 15 100.0
branch 4 4 100.0
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 24 26 92.3


line stmt bran cond sub pod time code
1 2     2   14 use strict;
  2         4  
  2         77  
2 2     2   12 use warnings;
  2         3  
  2         121  
3             package Rubric::Entry::Formatter::Nil;
4             # ABSTRACT: format entries by formatting nearly not at all
5             $Rubric::Entry::Formatter::Nil::VERSION = '0.155';
6             # =head1 DESCRIPTION
7             #
8             # This is the default formatter. The only formatting it performs is done by
9             # Template::Filters' C filter. Paragraph breaks will be
10             # retained from plaintext into HTML, but nothing else will be done.
11             #
12             # =cut
13              
14 2     2   1117 use Template::Filters;
  2         15429  
  2         305  
15              
16             # =head1 METHODS
17             #
18             # =cut
19              
20             my $filter = Template::Filters->new->fetch('html_para');
21              
22             sub as_html {
23 12     12 0 27 my ($class, $arg) = @_;
24 12 100       77 return '' unless $arg->{text};
25 5         46 return $filter->($arg->{text});
26             }
27              
28             sub as_text {
29 2     2 0 4 my ($class, $arg) = @_;
30 2 100       13 return '' unless $arg->{text};
31 1         5 return $arg->{text};
32             }
33              
34             1;
35              
36             __END__