line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Trac; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
719128
|
use strict; |
|
9
|
|
|
|
|
79
|
|
|
9
|
|
|
|
|
203
|
|
4
|
9
|
|
|
9
|
|
36
|
use warnings; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
170
|
|
5
|
|
|
|
|
|
|
|
6
|
9
|
|
|
9
|
|
152
|
use 5.006; |
|
9
|
|
|
|
|
24
|
|
7
|
9
|
|
|
9
|
|
2947
|
use Text::Trac::Context; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
45
|
|
8
|
9
|
|
|
9
|
|
3336
|
use Text::Trac::BlockNode; |
|
9
|
|
|
|
|
26
|
|
|
9
|
|
|
|
|
56
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.24'; |
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
|
34497
|
my ( $class, %args ) = @_; |
23
|
|
|
|
|
|
|
|
24
|
8
|
|
|
|
|
70
|
my $self = { %Defaults, %args, }; |
25
|
|
|
|
|
|
|
|
26
|
8
|
|
|
|
|
34
|
bless $self, $class; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub parse { |
30
|
120
|
|
|
120
|
1
|
232457
|
my $self = shift; |
31
|
120
|
50
|
|
|
|
382
|
my $text = shift or return; |
32
|
|
|
|
|
|
|
|
33
|
120
|
100
|
|
|
|
365
|
$self->{trac_url} = '/' unless defined $self->{trac_url}; |
34
|
120
|
|
|
|
|
511
|
for ( keys %$self ) { |
35
|
910
|
100
|
|
|
|
1687
|
if ( $_ =~ /^trac.+url$/ ) { |
36
|
184
|
100
|
|
|
|
605
|
$self->{$_} .= '/' if $self->{$_} !~ m!/$!; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
120
|
|
|
|
|
1129
|
my $c = Text::Trac::Context->new( |
41
|
|
|
|
|
|
|
{ |
42
|
|
|
|
|
|
|
%$self, text => $text, |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
120
|
|
|
|
|
736
|
my $node = Text::Trac::BlockNode->new( |
47
|
|
|
|
|
|
|
{ |
48
|
|
|
|
|
|
|
context => $c, |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
); |
51
|
120
|
|
|
|
|
506
|
$node->parse; |
52
|
|
|
|
|
|
|
|
53
|
120
|
|
|
|
|
375
|
$self->{html} = $c->html; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
120
|
|
|
120
|
1
|
1092
|
sub html { $_[0]->{html}; } |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
*process = \&parse; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
__END__ |