| 1 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | package Rubric::Entry::Formatter::HTMLEscape 0.157; | ||||||||||
| 4 | # ABSTRACT: format into HTML by escaping entities | ||||||||||
| 5 | |||||||||||
| 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<html> and | ||||||||||
| 12 | #pod C<html_para> filters. | ||||||||||
| 13 | #pod | ||||||||||
| 14 | #pod =cut | ||||||||||
| 15 | |||||||||||
| 16 | 1 | ▶ | use Template::Filters; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | #pod =head1 METHODS | ||||||||||
| 19 | #pod | ||||||||||
| 20 | #pod =cut | ||||||||||
| 21 | |||||||||||
| 22 | 1 | my ($filter, $html, $para); | |||||||||
| 23 | { | ||||||||||
| 24 | 1 | my $filters = Template::Filters->new; | |||||||||
| 25 | 1 | $html = $filters->fetch('html'); | |||||||||
| 26 | 1 | $para = $filters->fetch('html_para'); | |||||||||
| 27 | |||||||||||
| 28 | 1 | ▶ | $filter = sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 29 | 1 | $para->( $html->($_[0]) ); | |||||||||
| 30 | } | ||||||||||
| 31 | 1 | } | |||||||||
| 32 | |||||||||||
| 33 | 1 | ▶ | sub as_html { | ||||||||
|
Subroutine
as_html: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 34 | 1 | my ($class, $arg) = @_; | |||||||||
| 35 | 1 | ▶ | return '' unless $arg->{text}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 1 | return $filter->($arg->{text}); | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 1 | ▶ | sub as_text { | ||||||||
|
Subroutine
as_text: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 40 | 1 | my ($class, $arg) = @_; | |||||||||
| 41 | 1 | ▶ | return '' unless $arg->{text}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | 1 | return $html->($arg->{text}); | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 1 | 1; | |||||||||
| 46 | |||||||||||
| 47 | __END__ | ||||||||||