line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MKDoc::Text::Structured::UL; |
2
|
20
|
|
|
20
|
|
131
|
use base qw /MKDoc::Text::Structured::Base/; |
|
20
|
|
|
|
|
32
|
|
|
20
|
|
|
|
|
1690
|
|
3
|
20
|
|
|
20
|
|
111
|
use warnings; |
|
20
|
|
|
|
|
39
|
|
|
20
|
|
|
|
|
486
|
|
4
|
20
|
|
|
20
|
|
98
|
use strict; |
|
20
|
|
|
|
|
42
|
|
|
20
|
|
|
|
|
584
|
|
5
|
20
|
|
|
20
|
|
8596
|
use MKDoc::Text::Structured::LI; |
|
20
|
|
|
|
|
48
|
|
|
20
|
|
|
|
|
11673
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new |
9
|
|
|
|
|
|
|
{ |
10
|
274
|
|
|
274
|
0
|
357
|
my $class = shift; |
11
|
274
|
|
|
|
|
327
|
my $line = shift; |
12
|
|
|
|
|
|
|
|
13
|
274
|
|
|
|
|
624
|
my ($marker) = $line =~ /^((?:\*|\-)\s+)/; |
14
|
274
|
100
|
|
|
|
2084
|
return unless ($marker); |
15
|
|
|
|
|
|
|
|
16
|
7
|
|
|
|
|
70
|
my $self = $class->SUPER::new(); |
17
|
7
|
|
|
|
|
65
|
$self->{indent_re} = " " x length ($marker); |
18
|
7
|
|
|
|
|
55
|
return $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub is_ok |
23
|
|
|
|
|
|
|
{ |
24
|
52
|
|
|
52
|
0
|
73
|
my $self = shift; |
25
|
52
|
100
|
|
|
|
133
|
$self->{lines} || return 1; |
26
|
|
|
|
|
|
|
|
27
|
45
|
|
|
|
|
58
|
my $line = shift; |
28
|
45
|
|
|
|
|
65
|
my $re = $self->{indent_re}; |
29
|
45
|
100
|
|
|
|
106
|
$line eq '' and return 1; |
30
|
34
|
100
|
|
|
|
172
|
$line =~ /^\s+$/ and return 1; |
31
|
33
|
100
|
|
|
|
229
|
$line =~ /^$re/ and return 1; |
32
|
|
|
|
|
|
|
|
33
|
16
|
|
|
|
|
58
|
my ($marker) = $line =~ /^((?:\*|\-)\s+)/; |
34
|
16
|
100
|
|
|
|
44
|
$marker and do { |
35
|
13
|
|
|
|
|
27
|
$self->{indent_re} = " " x length ($marker); |
36
|
13
|
|
|
|
|
48
|
return 1; |
37
|
|
|
|
|
|
|
}; |
38
|
3
|
|
|
|
|
11
|
return; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub process |
43
|
|
|
|
|
|
|
{ |
44
|
7
|
|
|
7
|
0
|
14
|
my $self = shift; |
45
|
7
|
|
|
|
|
12
|
my @lines = @{$self->{lines}}; |
|
7
|
|
|
|
|
28
|
|
46
|
7
|
|
|
|
|
27
|
my $text = join "\n", @lines; |
47
|
7
|
|
|
|
|
29
|
$text = $self->process_li ($text); |
48
|
7
|
|
|
|
|
126
|
return ""; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub process_li |
53
|
|
|
|
|
|
|
{ |
54
|
7
|
|
|
7
|
0
|
11
|
my $self = shift; |
55
|
7
|
|
|
|
|
12
|
my $text = shift; |
56
|
7
|
|
|
|
|
110
|
my @lines = split /\n/, $text; |
57
|
7
|
|
|
|
|
16
|
my @result = (); |
58
|
7
|
|
|
|
|
10
|
my $current = undef; |
59
|
|
|
|
|
|
|
|
60
|
7
|
|
|
|
|
33
|
while (scalar @lines) |
61
|
|
|
|
|
|
|
{ |
62
|
58
|
|
|
|
|
86
|
my $line = shift (@lines); |
63
|
58
|
|
66
|
|
|
700
|
$current ||= new MKDoc::Text::Structured::LI ($line); |
64
|
58
|
50
|
|
|
|
111
|
$current || next; |
65
|
|
|
|
|
|
|
|
66
|
58
|
100
|
|
|
|
136
|
if ($current->is_ok ($line)) |
67
|
|
|
|
|
|
|
{ |
68
|
45
|
|
|
|
|
145
|
$current->add_line ($line); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
else |
71
|
|
|
|
|
|
|
{ |
72
|
13
|
|
|
|
|
116
|
push @result, $current->process(); |
73
|
13
|
|
|
|
|
31
|
unshift (@lines, $line); |
74
|
13
|
|
|
|
|
95
|
$current = undef; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
7
|
50
|
|
|
|
67
|
push @result, $current->process() if ($current); |
79
|
7
|
|
|
|
|
62
|
return join "\n", @result; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |