line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Trac; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
854259
|
use strict; |
|
9
|
|
|
|
|
94
|
|
|
9
|
|
|
|
|
250
|
|
4
|
9
|
|
|
9
|
|
43
|
use warnings; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
211
|
|
5
|
|
|
|
|
|
|
|
6
|
9
|
|
|
9
|
|
175
|
use 5.006; |
|
9
|
|
|
|
|
29
|
|
7
|
9
|
|
|
9
|
|
3711
|
use Text::Trac::Context; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
52
|
|
8
|
9
|
|
|
9
|
|
3999
|
use Text::Trac::BlockNode; |
|
9
|
|
|
|
|
29
|
|
|
9
|
|
|
|
|
63
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.23'; |
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
|
41847
|
my ( $class, %args ) = @_; |
23
|
|
|
|
|
|
|
|
24
|
8
|
|
|
|
|
75
|
my $self = { %Defaults, %args, }; |
25
|
|
|
|
|
|
|
|
26
|
8
|
|
|
|
|
35
|
bless $self, $class; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub parse { |
30
|
120
|
|
|
120
|
1
|
250647
|
my $self = shift; |
31
|
120
|
50
|
|
|
|
462
|
my $text = shift or return; |
32
|
|
|
|
|
|
|
|
33
|
120
|
100
|
|
|
|
376
|
$self->{trac_url} = '/' unless defined $self->{trac_url}; |
34
|
120
|
|
|
|
|
571
|
for ( keys %$self ) { |
35
|
910
|
100
|
|
|
|
1961
|
if ( $_ =~ /^trac.+url$/ ) { |
36
|
184
|
100
|
|
|
|
701
|
$self->{$_} .= '/' if $self->{$_} !~ m!/$!; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
120
|
|
|
|
|
1340
|
my $c = Text::Trac::Context->new( |
41
|
|
|
|
|
|
|
{ |
42
|
|
|
|
|
|
|
%$self, text => $text, |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
120
|
|
|
|
|
854
|
my $node = Text::Trac::BlockNode->new( |
47
|
|
|
|
|
|
|
{ |
48
|
|
|
|
|
|
|
context => $c, |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
); |
51
|
120
|
|
|
|
|
645
|
$node->parse; |
52
|
|
|
|
|
|
|
|
53
|
120
|
|
|
|
|
394
|
$self->{html} = $c->html; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
120
|
|
|
120
|
1
|
1085
|
sub html { $_[0]->{html}; } |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
*process = \&parse; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
__END__ |