line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
9
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
47
|
|
2
|
1
|
|
|
1
|
|
11
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
92
|
|
3
|
|
|
|
|
|
|
package Rubric::Entry::Formatter::HTMLEscape; |
4
|
|
|
|
|
|
|
# ABSTRACT: format into HTML by escaping entities |
5
|
|
|
|
|
|
|
$Rubric::Entry::Formatter::HTMLEscape::VERSION = '0.156'; |
6
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
7
|
|
|
|
|
|
|
#pod |
8
|
|
|
|
|
|
|
#pod This formatter only handles formatting to HTML, and outputs the original |
9
|
|
|
|
|
|
|
#pod content with HTML-unsafe characters escaped and paragraphs broken. |
10
|
|
|
|
|
|
|
#pod |
11
|
|
|
|
|
|
|
#pod This is equivalent to filtering with Template::Filters' C and |
12
|
|
|
|
|
|
|
#pod C filters. |
13
|
|
|
|
|
|
|
#pod |
14
|
|
|
|
|
|
|
#pod =cut |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
8
|
use Template::Filters; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
362
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#pod =head1 METHODS |
19
|
|
|
|
|
|
|
#pod |
20
|
|
|
|
|
|
|
#pod =cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my ($filter, $html, $para); |
23
|
|
|
|
|
|
|
{ |
24
|
|
|
|
|
|
|
my $filters = Template::Filters->new; |
25
|
|
|
|
|
|
|
$html = $filters->fetch('html'); |
26
|
|
|
|
|
|
|
$para = $filters->fetch('html_para'); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$filter = sub { |
29
|
|
|
|
|
|
|
$para->( $html->($_[0]) ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub as_html { |
34
|
1
|
|
|
1
|
0
|
4
|
my ($class, $arg) = @_; |
35
|
1
|
50
|
|
|
|
6
|
return '' unless $arg->{text}; |
36
|
1
|
|
|
|
|
5
|
return $filter->($arg->{text}); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub as_text { |
40
|
1
|
|
|
1
|
0
|
2
|
my ($class, $arg) = @_; |
41
|
1
|
50
|
|
|
|
6
|
return '' unless $arg->{text}; |
42
|
1
|
|
|
|
|
4
|
return $html->($arg->{text}); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |