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