line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Trac; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
841580
|
use strict; |
|
9
|
|
|
|
|
83
|
|
|
9
|
|
|
|
|
248
|
|
4
|
9
|
|
|
9
|
|
46
|
use warnings; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
217
|
|
5
|
|
|
|
|
|
|
|
6
|
9
|
|
|
9
|
|
159
|
use 5.006; |
|
9
|
|
|
|
|
30
|
|
7
|
9
|
|
|
9
|
|
3591
|
use Text::Trac::Context; |
|
9
|
|
|
|
|
26
|
|
|
9
|
|
|
|
|
49
|
|
8
|
9
|
|
|
9
|
|
3926
|
use Text::Trac::BlockNode; |
|
9
|
|
|
|
|
31
|
|
|
9
|
|
|
|
|
97
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.22'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my %Defaults = ( |
13
|
|
|
|
|
|
|
html => '', |
14
|
|
|
|
|
|
|
permalink => '', |
15
|
|
|
|
|
|
|
min_heading_level => 1, |
16
|
|
|
|
|
|
|
class => 1, |
17
|
|
|
|
|
|
|
id => 1, |
18
|
|
|
|
|
|
|
span => 1, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
8
|
|
|
8
|
1
|
41309
|
my ( $class, %args ) = @_; |
23
|
|
|
|
|
|
|
|
24
|
8
|
|
|
|
|
61
|
my $self = { %Defaults, %args, }; |
25
|
|
|
|
|
|
|
|
26
|
8
|
|
|
|
|
37
|
bless $self, $class; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub parse { |
30
|
120
|
|
|
120
|
1
|
247727
|
my $self = shift; |
31
|
120
|
50
|
|
|
|
486
|
my $text = shift or return; |
32
|
|
|
|
|
|
|
|
33
|
120
|
100
|
|
|
|
400
|
$self->{trac_url} = '/' unless defined $self->{trac_url}; |
34
|
120
|
|
|
|
|
555
|
for ( keys %$self ) { |
35
|
910
|
100
|
|
|
|
1935
|
if ( $_ =~ /^trac.+url$/ ) { |
36
|
184
|
100
|
|
|
|
708
|
$self->{$_} .= '/' if $self->{$_} !~ m!/$!; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
120
|
|
|
|
|
1266
|
my $c = Text::Trac::Context->new( |
41
|
|
|
|
|
|
|
{ |
42
|
|
|
|
|
|
|
%$self, text => $text, |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
120
|
|
|
|
|
793
|
my $node = Text::Trac::BlockNode->new( |
47
|
|
|
|
|
|
|
{ |
48
|
|
|
|
|
|
|
context => $c, |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
); |
51
|
120
|
|
|
|
|
566
|
$node->parse; |
52
|
|
|
|
|
|
|
|
53
|
120
|
|
|
|
|
396
|
$self->{html} = $c->html; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
120
|
|
|
120
|
1
|
1080
|
sub html { $_[0]->{html}; } |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
*process = \&parse; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
__END__ |