line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Trac::P; |
2
|
8
|
|
|
8
|
|
46
|
use strict; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
501
|
|
3
|
8
|
|
|
8
|
|
35
|
use warnings; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
185
|
|
4
|
8
|
|
|
8
|
|
33
|
use base qw(Text::Trac::BlockNode); |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
39
|
|
5
|
8
|
|
|
8
|
|
3269
|
use Text::Trac::Text; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
84
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.24'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub parse { |
10
|
100
|
|
|
100
|
0
|
245
|
my ( $self, $l ) = @_; |
11
|
100
|
|
|
|
|
189
|
my $c = $self->{context}; |
12
|
|
|
|
|
|
|
|
13
|
100
|
50
|
66
|
|
|
142
|
if ( !@{ $c->in_block_of } or $c->in_block_of->[-1] ne 'p' ) { |
|
100
|
|
|
|
|
1583
|
|
14
|
100
|
|
|
|
|
983
|
$c->htmllines(' '); |
15
|
100
|
|
|
|
|
189
|
push @{ $c->in_block_of }, 'p'; |
|
100
|
|
|
|
|
1448
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# define block parsers called. |
19
|
100
|
|
|
|
|
728
|
$self->block_nodes( [qw( blockquote hr )] ); |
20
|
100
|
|
|
|
|
1144
|
$self->block_parsers( $self->_get_parsers('block') ); |
21
|
|
|
|
|
|
|
|
22
|
100
|
|
|
|
|
2728
|
my $cite_depth = 0; |
23
|
100
|
|
|
|
|
364
|
$c->unshiftline; |
24
|
100
|
|
|
|
|
282
|
while ( $c->hasnext ) { |
25
|
114
|
100
|
|
|
|
319
|
last if $c->nextline =~ /^$/; |
26
|
112
|
|
|
|
|
274
|
$l = $c->shiftline; |
27
|
112
|
100
|
|
|
|
399
|
last if $l =~ /^\s+$/; |
28
|
|
|
|
|
|
|
|
29
|
111
|
|
|
|
|
174
|
my $blockquote_depth = 0; |
30
|
111
|
|
|
|
|
176
|
for ( @{ $c->in_block_of } ) { |
|
111
|
|
|
|
|
1921
|
|
31
|
129
|
100
|
|
|
|
749
|
$blockquote_depth++ if $_ eq 'blockquote'; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
111
|
100
|
100
|
|
|
724
|
if ( $l =~ /^(>+)/ ) { |
|
|
100
|
|
|
|
|
|
35
|
7
|
|
|
|
|
13
|
$cite_depth = length $1; |
36
|
7
|
100
|
|
|
|
37
|
if ( $blockquote_depth != $cite_depth ) { |
37
|
1
|
|
|
|
|
4
|
$c->unshiftline; |
38
|
1
|
|
|
|
|
2
|
last; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
else { |
41
|
6
|
|
|
|
|
21
|
$l =~ s/^>+//; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
elsif ( $l !~ /^(?:>|\s+)/ and $blockquote_depth ) { |
45
|
2
|
|
|
|
|
5
|
$c->htmllines(''); |
46
|
2
|
|
|
|
|
3
|
pop @{ $c->in_block_of }; |
|
2
|
|
|
|
|
30
|
|
47
|
2
|
|
|
|
|
11
|
for ( 1 .. $blockquote_depth ) { |
48
|
3
|
|
|
|
|
13
|
$c->htmllines(''); |
49
|
3
|
|
|
|
|
12
|
pop @{ $c->in_block_of }; |
|
3
|
|
|
|
|
42
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
11
|
$c->unshiftline; |
53
|
2
|
|
|
|
|
2
|
last; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# parse other block nodes |
57
|
108
|
|
|
|
|
361
|
my $parsers = $self->_get_matched_parsers( 'block', $l ); |
58
|
108
|
100
|
|
|
|
181
|
if ( grep { ref($_) ne 'Text::Trac::P' } @{$parsers} ) { |
|
108
|
|
|
|
|
457
|
|
|
108
|
|
|
|
|
215
|
|
59
|
1
|
|
|
|
|
4
|
$c->htmllines(''); |
60
|
1
|
|
|
|
|
1
|
pop @{ $c->in_block_of }; |
|
1
|
|
|
|
|
15
|
|
61
|
1
|
|
|
|
|
6
|
$c->unshiftline; |
62
|
1
|
|
|
|
|
2
|
last; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# parse inline nodes |
66
|
107
|
|
|
|
|
675
|
$l = $self->replace($l); |
67
|
107
|
|
|
|
|
3923
|
$c->htmllines($l); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
100
|
100
|
66
|
|
|
181
|
if ( @{ $c->in_block_of } and $c->in_block_of->[-1] eq 'p' ) { |
|
100
|
|
|
|
|
1757
|
|
71
|
97
|
|
|
|
|
2470
|
$c->htmllines(''); |
72
|
97
|
|
|
|
|
127
|
pop @{ $c->in_block_of }; |
|
97
|
|
|
|
|
1392
|
|
73
|
|
|
|
|
|
|
|
74
|
97
|
|
|
|
|
394
|
my $blockquote_depth = 0; |
75
|
97
|
|
|
|
|
137
|
for ( @{ $c->in_block_of } ) { |
|
97
|
|
|
|
|
1372
|
|
76
|
5
|
50
|
|
|
|
25
|
$blockquote_depth++ if $_ eq 'blockquote'; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
97
|
100
|
|
|
|
585
|
if ($cite_depth) { |
80
|
1
|
|
|
|
|
3
|
for ( $blockquote_depth .. length $1 ) { |
81
|
1
|
|
|
|
|
4
|
$c->htmllines(''); |
82
|
1
|
|
|
|
|
1
|
pop @{ $c->in_block_of }; |
|
1
|
|
|
|
|
16
|
|
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
100
|
|
|
|
|
1016
|
return; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |