line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Trac::P; |
2
|
8
|
|
|
8
|
|
56
|
use strict; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
245
|
|
3
|
8
|
|
|
8
|
|
40
|
use warnings; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
224
|
|
4
|
8
|
|
|
8
|
|
40
|
use base qw(Text::Trac::BlockNode); |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
41
|
|
5
|
8
|
|
|
8
|
|
4056
|
use Text::Trac::Text; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
103
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.23'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub parse { |
10
|
100
|
|
|
100
|
0
|
261
|
my ( $self, $l ) = @_; |
11
|
100
|
|
|
|
|
228
|
my $c = $self->{context}; |
12
|
|
|
|
|
|
|
|
13
|
100
|
50
|
66
|
|
|
173
|
if ( !@{ $c->in_block_of } or $c->in_block_of->[-1] ne 'p' ) { |
|
100
|
|
|
|
|
1904
|
|
14
|
100
|
|
|
|
|
1054
|
$c->htmllines(' '); |
15
|
100
|
|
|
|
|
167
|
push @{ $c->in_block_of }, 'p'; |
|
100
|
|
|
|
|
1751
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# define block parsers called. |
19
|
100
|
|
|
|
|
868
|
$self->block_nodes( [qw( blockquote hr )] ); |
20
|
100
|
|
|
|
|
1395
|
$self->block_parsers( $self->_get_parsers('block') ); |
21
|
|
|
|
|
|
|
|
22
|
100
|
|
|
|
|
2896
|
my $cite_depth = 0; |
23
|
100
|
|
|
|
|
422
|
$c->unshiftline; |
24
|
100
|
|
|
|
|
342
|
while ( $c->hasnext ) { |
25
|
114
|
100
|
|
|
|
378
|
last if $c->nextline =~ /^$/; |
26
|
112
|
|
|
|
|
303
|
$l = $c->shiftline; |
27
|
112
|
100
|
|
|
|
447
|
last if $l =~ /^\s+$/; |
28
|
|
|
|
|
|
|
|
29
|
111
|
|
|
|
|
204
|
my $blockquote_depth = 0; |
30
|
111
|
|
|
|
|
163
|
for ( @{ $c->in_block_of } ) { |
|
111
|
|
|
|
|
2307
|
|
31
|
129
|
100
|
|
|
|
839
|
$blockquote_depth++ if $_ eq 'blockquote'; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
111
|
100
|
100
|
|
|
818
|
if ( $l =~ /^(>+)/ ) { |
|
|
100
|
|
|
|
|
|
35
|
7
|
|
|
|
|
19
|
$cite_depth = length $1; |
36
|
7
|
100
|
|
|
|
21
|
if ( $blockquote_depth != $cite_depth ) { |
37
|
1
|
|
|
|
|
6
|
$c->unshiftline; |
38
|
1
|
|
|
|
|
4
|
last; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
else { |
41
|
6
|
|
|
|
|
23
|
$l =~ s/^>+//; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
elsif ( $l !~ /^(?:>|\s+)/ and $blockquote_depth ) { |
45
|
2
|
|
|
|
|
10
|
$c->htmllines(''); |
46
|
2
|
|
|
|
|
4
|
pop @{ $c->in_block_of }; |
|
2
|
|
|
|
|
37
|
|
47
|
2
|
|
|
|
|
16
|
for ( 1 .. $blockquote_depth ) { |
48
|
3
|
|
|
|
|
15
|
$c->htmllines(''); |
49
|
3
|
|
|
|
|
6
|
pop @{ $c->in_block_of }; |
|
3
|
|
|
|
|
52
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
15
|
$c->unshiftline; |
53
|
2
|
|
|
|
|
5
|
last; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# parse other block nodes |
57
|
108
|
|
|
|
|
382
|
my $parsers = $self->_get_matched_parsers( 'block', $l ); |
58
|
108
|
100
|
|
|
|
231
|
if ( grep { ref($_) ne 'Text::Trac::P' } @{$parsers} ) { |
|
108
|
|
|
|
|
551
|
|
|
108
|
|
|
|
|
278
|
|
59
|
1
|
|
|
|
|
4
|
$c->htmllines(''); |
60
|
1
|
|
|
|
|
2
|
pop @{ $c->in_block_of }; |
|
1
|
|
|
|
|
19
|
|
61
|
1
|
|
|
|
|
7
|
$c->unshiftline; |
62
|
1
|
|
|
|
|
3
|
last; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# parse inline nodes |
66
|
107
|
|
|
|
|
440
|
$l = $self->replace($l); |
67
|
107
|
|
|
|
|
4624
|
$c->htmllines($l); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
100
|
100
|
66
|
|
|
224
|
if ( @{ $c->in_block_of } and $c->in_block_of->[-1] eq 'p' ) { |
|
100
|
|
|
|
|
1892
|
|
71
|
97
|
|
|
|
|
2785
|
$c->htmllines(''); |
72
|
97
|
|
|
|
|
171
|
pop @{ $c->in_block_of }; |
|
97
|
|
|
|
|
1631
|
|
73
|
|
|
|
|
|
|
|
74
|
97
|
|
|
|
|
472
|
my $blockquote_depth = 0; |
75
|
97
|
|
|
|
|
158
|
for ( @{ $c->in_block_of } ) { |
|
97
|
|
|
|
|
1579
|
|
76
|
5
|
50
|
|
|
|
31
|
$blockquote_depth++ if $_ eq 'blockquote'; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
97
|
100
|
|
|
|
594
|
if ($cite_depth) { |
80
|
1
|
|
|
|
|
6
|
for ( $blockquote_depth .. length $1 ) { |
81
|
1
|
|
|
|
|
5
|
$c->htmllines(''); |
82
|
1
|
|
|
|
|
3
|
pop @{ $c->in_block_of }; |
|
1
|
|
|
|
|
20
|
|
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
100
|
|
|
|
|
1073
|
return; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |