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