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