line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Textile2; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
83873
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
46
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
5
|
1
|
|
|
1
|
|
4414
|
use Template::Plugin::Filter; |
|
1
|
|
|
|
|
2647
|
|
|
1
|
|
|
|
|
38
|
|
6
|
1
|
|
|
1
|
|
1526
|
use Text::Textile; |
|
1
|
|
|
|
|
96081
|
|
|
1
|
|
|
|
|
227
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = "1.21"; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
13
|
use base qw/Template::Plugin::Filter/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
324
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub init { |
13
|
1
|
|
|
1
|
0
|
70
|
my ($self, $args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
1
|
50
|
33
|
|
|
11
|
die 'Args must be an hashref' |
16
|
|
|
|
|
|
|
if (defined $args) && (ref $args ne 'HASH'); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$self-> { _FORMAT_MODE } |
19
|
1
|
|
50
|
|
|
17
|
= $args->{format_mode} || 'default'; |
20
|
1
|
|
|
|
|
3
|
delete $args->{format_mode}; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
7
|
$self->{ _TEXTILE } = Text::Textile->new( |
23
|
|
|
|
|
|
|
%$args |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
50
|
|
|
510
|
my $name = $self->{ _CONFIG }->{ name } || 'textile2'; |
27
|
1
|
|
|
|
|
9
|
$self->install_filter($name); |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
50
|
return $self; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub filter { |
33
|
1
|
|
|
1
|
0
|
76
|
my ($self, $text) = @_; |
34
|
|
|
|
|
|
|
|
35
|
1
|
50
|
|
|
|
7
|
if ( $self->{_FORMAT_MODE} eq 'inline' ) { |
36
|
0
|
|
|
|
|
0
|
return $self->{_TEXTILE}->format_inline(text => $text); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
1
|
|
|
|
|
7
|
return $self->{_TEXTILE}->process($text); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |