line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MKDoc::Text::Structured::OL; |
2
|
20
|
|
|
20
|
|
104
|
use base qw /MKDoc::Text::Structured::Base/; |
|
20
|
|
|
|
|
37
|
|
|
20
|
|
|
|
|
4446
|
|
3
|
20
|
|
|
20
|
|
118
|
use warnings; |
|
20
|
|
|
|
|
45
|
|
|
20
|
|
|
|
|
498
|
|
4
|
20
|
|
|
20
|
|
110
|
use strict; |
|
20
|
|
|
|
|
35
|
|
|
20
|
|
|
|
|
565
|
|
5
|
20
|
|
|
20
|
|
161
|
use MKDoc::Text::Structured::LI; |
|
20
|
|
|
|
|
41
|
|
|
20
|
|
|
|
|
9481
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new |
9
|
|
|
|
|
|
|
{ |
10
|
267
|
|
|
267
|
0
|
447
|
my $class = shift; |
11
|
267
|
|
|
|
|
490
|
my $line = shift; |
12
|
|
|
|
|
|
|
|
13
|
267
|
|
|
|
|
523
|
my ($marker) = $line =~ /^(\d+\.\s+)/; |
14
|
267
|
100
|
|
|
|
2219
|
return unless ($marker); |
15
|
|
|
|
|
|
|
|
16
|
6
|
|
|
|
|
67
|
my $self = $class->SUPER::new(); |
17
|
6
|
|
|
|
|
44
|
$self->{indent_re} = " " x length ($marker); |
18
|
6
|
|
|
|
|
55
|
return $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub is_ok |
23
|
|
|
|
|
|
|
{ |
24
|
29
|
|
|
29
|
0
|
32
|
my $self = shift; |
25
|
29
|
100
|
|
|
|
81
|
$self->{lines} || return 1; |
26
|
|
|
|
|
|
|
|
27
|
23
|
|
|
|
|
32
|
my $line = shift; |
28
|
23
|
|
|
|
|
34
|
my $re = $self->{indent_re}; |
29
|
23
|
100
|
|
|
|
71
|
$line eq '' and return 1; |
30
|
14
|
50
|
|
|
|
54
|
$line =~ /^\s+$/ and return 1; |
31
|
14
|
100
|
|
|
|
142
|
$line =~ /^$re/ and return 1; |
32
|
|
|
|
|
|
|
|
33
|
3
|
|
|
|
|
13
|
my ($marker) = $line =~ /^(\d+\.\s+)/; |
34
|
3
|
50
|
|
|
|
11
|
$marker and do { |
35
|
3
|
|
|
|
|
8
|
$self->{indent_re} = " " x length ($marker); |
36
|
3
|
|
|
|
|
12
|
return 1; |
37
|
|
|
|
|
|
|
}; |
38
|
0
|
|
|
|
|
0
|
return; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub process |
43
|
|
|
|
|
|
|
{ |
44
|
6
|
|
|
6
|
0
|
10
|
my $self = shift; |
45
|
6
|
|
|
|
|
13
|
my @lines = @{$self->{lines}}; |
|
6
|
|
|
|
|
22
|
|
46
|
6
|
|
|
|
|
31
|
my $text = join "\n", @lines; |
47
|
6
|
|
|
|
|
32
|
$text = $self->process_li ($text); |
48
|
6
|
|
|
|
|
36
|
return "$text "; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub process_li |
53
|
|
|
|
|
|
|
{ |
54
|
6
|
|
|
6
|
0
|
18
|
my $self = shift; |
55
|
6
|
|
|
|
|
13
|
my $text = shift; |
56
|
6
|
|
|
|
|
46
|
my @lines = split /\n/, $text; |
57
|
6
|
|
|
|
|
15
|
my @result = (); |
58
|
6
|
|
|
|
|
10
|
my $current = undef; |
59
|
|
|
|
|
|
|
|
60
|
6
|
|
|
|
|
21
|
while (scalar @lines) |
61
|
|
|
|
|
|
|
{ |
62
|
32
|
|
|
|
|
61
|
my $line = shift (@lines); |
63
|
32
|
|
66
|
|
|
434
|
$current ||= new MKDoc::Text::Structured::LI ($line); |
64
|
32
|
50
|
|
|
|
73
|
$current || next; |
65
|
|
|
|
|
|
|
|
66
|
32
|
100
|
|
|
|
93
|
if ($current->is_ok ($line)) |
67
|
|
|
|
|
|
|
{ |
68
|
29
|
|
|
|
|
91
|
$current->add_line ($line); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
else |
71
|
|
|
|
|
|
|
{ |
72
|
3
|
|
|
|
|
12
|
push @result, $current->process(); |
73
|
3
|
|
|
|
|
9
|
unshift (@lines, $line); |
74
|
3
|
|
|
|
|
35
|
$current = undef; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
6
|
50
|
|
|
|
51
|
push @result, $current->process() if ($current); |
79
|
6
|
|
|
|
|
50
|
return join "\n", @result; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |