line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Trac::Heading; |
2
|
8
|
|
|
8
|
|
59
|
use strict; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
248
|
|
3
|
8
|
|
|
8
|
|
43
|
use warnings; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
238
|
|
4
|
8
|
|
|
8
|
|
41
|
use base qw(Text::Trac::BlockNode); |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
43
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.23'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub init { |
9
|
120
|
|
|
120
|
0
|
230
|
my $self = shift; |
10
|
120
|
|
|
|
|
2402
|
$self->pattern(qr/^(=+) \s (.*) \s (=+)$/xms); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub parse { |
14
|
6
|
|
|
6
|
0
|
17
|
my ( $self, $l ) = @_; |
15
|
6
|
|
|
|
|
102
|
my $c = $self->context; |
16
|
|
|
|
|
|
|
|
17
|
6
|
50
|
|
|
|
116
|
$l =~ $self->pattern or return; |
18
|
6
|
|
|
|
|
168
|
my $level = length($1) + $c->min_heading_level - 1; |
19
|
|
|
|
|
|
|
|
20
|
6
|
|
|
|
|
45
|
my $id = $self->_strip($2); |
21
|
6
|
50
|
|
|
|
28
|
my $attr = $c->{id} ? qq{ id="$id"} : ''; |
22
|
6
|
|
|
|
|
38
|
$l = qq() . $self->replace($2) . qq(); |
23
|
|
|
|
|
|
|
|
24
|
6
|
|
|
|
|
499
|
$c->htmllines($l); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _strip { |
28
|
6
|
|
|
6
|
|
30
|
my ( $self, $word ) = @_; |
29
|
6
|
|
|
|
|
33
|
$word =~ s/[\s,_`'{}!]//g; |
30
|
6
|
|
|
|
|
17
|
return $word; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |