line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Trac::P; |
2
|
8
|
|
|
8
|
|
56
|
use strict; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
287
|
|
3
|
8
|
|
|
8
|
|
46
|
use warnings; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
225
|
|
4
|
8
|
|
|
8
|
|
38
|
use base qw(Text::Trac::BlockNode); |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
39
|
|
5
|
8
|
|
|
8
|
|
3955
|
use Text::Trac::Text; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
99
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.22'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub parse { |
10
|
100
|
|
|
100
|
0
|
287
|
my ( $self, $l ) = @_; |
11
|
100
|
|
|
|
|
252
|
my $c = $self->{context}; |
12
|
|
|
|
|
|
|
|
13
|
100
|
50
|
66
|
|
|
170
|
if ( !@{ $c->in_block_of } or $c->in_block_of->[-1] ne 'p' ) { |
|
100
|
|
|
|
|
1873
|
|
14
|
100
|
|
|
|
|
1069
|
$c->htmllines(' '); |
15
|
100
|
|
|
|
|
159
|
push @{ $c->in_block_of }, 'p'; |
|
100
|
|
|
|
|
1757
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# define block parsers called. |
19
|
100
|
|
|
|
|
824
|
$self->block_nodes( [qw( blockquote hr )] ); |
20
|
100
|
|
|
|
|
1371
|
$self->block_parsers( $self->_get_parsers('block') ); |
21
|
|
|
|
|
|
|
|
22
|
100
|
|
|
|
|
3017
|
my $cite_depth = 0; |
23
|
100
|
|
|
|
|
390
|
$c->unshiftline; |
24
|
100
|
|
|
|
|
339
|
while ( $c->hasnext ) { |
25
|
114
|
100
|
|
|
|
364
|
last if $c->nextline =~ /^$/; |
26
|
112
|
|
|
|
|
302
|
$l = $c->shiftline; |
27
|
112
|
100
|
|
|
|
444
|
last if $l =~ /^\s+$/; |
28
|
|
|
|
|
|
|
|
29
|
111
|
|
|
|
|
217
|
my $blockquote_depth = 0; |
30
|
111
|
|
|
|
|
188
|
for ( @{ $c->in_block_of } ) { |
|
111
|
|
|
|
|
2312
|
|
31
|
129
|
100
|
|
|
|
942
|
$blockquote_depth++ if $_ eq 'blockquote'; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
111
|
100
|
100
|
|
|
795
|
if ( $l =~ /^(>+)/ ) { |
|
|
100
|
|
|
|
|
|
35
|
7
|
|
|
|
|
43
|
$cite_depth = length $1; |
36
|
7
|
100
|
|
|
|
24
|
if ( $blockquote_depth != $cite_depth ) { |
37
|
1
|
|
|
|
|
5
|
$c->unshiftline; |
38
|
1
|
|
|
|
|
4
|
last; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
else { |
41
|
6
|
|
|
|
|
22
|
$l =~ s/^>+//; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
elsif ( $l !~ /^(?:>|\s+)/ and $blockquote_depth ) { |
45
|
2
|
|
|
|
|
8
|
$c->htmllines(''); |
46
|
2
|
|
|
|
|
3
|
pop @{ $c->in_block_of }; |
|
2
|
|
|
|
|
51
|
|
47
|
2
|
|
|
|
|
13
|
for ( 1 .. $blockquote_depth ) { |
48
|
3
|
|
|
|
|
15
|
$c->htmllines(''); |
49
|
3
|
|
|
|
|
5
|
pop @{ $c->in_block_of }; |
|
3
|
|
|
|
|
51
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
14
|
$c->unshiftline; |
53
|
2
|
|
|
|
|
4
|
last; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# parse other block nodes |
57
|
108
|
|
|
|
|
418
|
my $parsers = $self->_get_matched_parsers( 'block', $l ); |
58
|
108
|
100
|
|
|
|
254
|
if ( grep { ref($_) ne 'Text::Trac::P' } @{$parsers} ) { |
|
108
|
|
|
|
|
526
|
|
|
108
|
|
|
|
|
276
|
|
59
|
1
|
|
|
|
|
4
|
$c->htmllines(''); |
60
|
1
|
|
|
|
|
2
|
pop @{ $c->in_block_of }; |
|
1
|
|
|
|
|
19
|
|
61
|
1
|
|
|
|
|
8
|
$c->unshiftline; |
62
|
1
|
|
|
|
|
3
|
last; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# parse inline nodes |
66
|
107
|
|
|
|
|
466
|
$l = $self->replace($l); |
67
|
107
|
|
|
|
|
4700
|
$c->htmllines($l); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
100
|
100
|
66
|
|
|
203
|
if ( @{ $c->in_block_of } and $c->in_block_of->[-1] eq 'p' ) { |
|
100
|
|
|
|
|
1910
|
|
71
|
97
|
|
|
|
|
2758
|
$c->htmllines(''); |
72
|
97
|
|
|
|
|
152
|
pop @{ $c->in_block_of }; |
|
97
|
|
|
|
|
1682
|
|
73
|
|
|
|
|
|
|
|
74
|
97
|
|
|
|
|
491
|
my $blockquote_depth = 0; |
75
|
97
|
|
|
|
|
173
|
for ( @{ $c->in_block_of } ) { |
|
97
|
|
|
|
|
1601
|
|
76
|
5
|
50
|
|
|
|
33
|
$blockquote_depth++ if $_ eq 'blockquote'; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
97
|
100
|
|
|
|
595
|
if ($cite_depth) { |
80
|
1
|
|
|
|
|
4
|
for ( $blockquote_depth .. length $1 ) { |
81
|
1
|
|
|
|
|
5
|
$c->htmllines(''); |
82
|
1
|
|
|
|
|
2
|
pop @{ $c->in_block_of }; |
|
1
|
|
|
|
|
19
|
|
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
100
|
|
|
|
|
1103
|
return; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |