line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Livedoor::Wiki::Plugin::Base::Block::List; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
2647
|
use warnings; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
152
|
|
4
|
5
|
|
|
5
|
|
28
|
use strict; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
157
|
|
5
|
5
|
|
|
5
|
|
55
|
use base qw(Text::Livedoor::Wiki::Plugin::Block); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
1071
|
|
6
|
|
|
|
|
|
|
sub list { |
7
|
3
|
|
|
3
|
1
|
8
|
my $self = shift; |
8
|
3
|
|
|
|
|
7
|
my $inline = shift; |
9
|
3
|
|
|
|
|
8
|
my $items = shift; |
10
|
3
|
|
|
|
|
5
|
my $tag = shift; |
11
|
3
|
|
|
|
|
9
|
my $id = $items->[0]{id}; |
12
|
3
|
|
|
|
|
5
|
my $level = 1; |
13
|
3
|
|
|
|
|
12
|
my $data = qq|<$tag id="$id" class="list-1">\n|; |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
|
|
8
|
my $fix_data = ''; |
16
|
3
|
|
|
|
|
4
|
my $last = scalar @$items; |
17
|
3
|
|
|
|
|
12
|
my $cnt=0; |
18
|
3
|
|
|
|
|
8
|
for my $item ( @$items ) { |
19
|
12
|
|
|
|
|
17
|
$cnt++; |
20
|
12
|
|
|
|
|
17
|
my $on_deep= 0; |
21
|
12
|
|
|
|
|
45
|
while( $level != $item->{level} ) { |
22
|
10
|
100
|
|
|
|
25
|
if( $level > $item->{level} ) { |
23
|
4
|
|
|
|
|
5
|
$level--; |
24
|
4
|
|
|
|
|
14
|
$data .= "$tag>\n\n" ; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
else { |
27
|
6
|
|
|
|
|
10
|
$level++; |
28
|
6
|
|
|
|
|
29
|
$data .= qq|<$tag class="list-$item->{level}">\n|; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
12
|
100
|
|
|
|
27
|
if( $cnt != $last ) { |
32
|
9
|
|
|
|
|
15
|
my $next_item = $items->[$cnt]; |
33
|
9
|
100
|
|
|
|
27
|
if( $level < $next_item->{level} ) { |
34
|
6
|
|
|
|
|
12
|
$on_deep =1; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
12
|
|
|
|
|
53
|
$data .= "" . $inline->parse($item->{line}); |
38
|
12
|
100
|
|
|
|
46
|
$data .= $on_deep ? "\n" : "\n" ; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
3
|
|
|
|
|
15
|
while( $level >1 ) { |
42
|
2
|
|
|
|
|
8
|
$data .= "$tag>\n\n" ; |
43
|
2
|
|
|
|
|
7
|
$level--; |
44
|
|
|
|
|
|
|
} |
45
|
3
|
|
|
|
|
10
|
$data .= "$tag>\n"; |
46
|
3
|
|
|
|
|
22
|
return $data; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 NAME |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Text::Livedoor::Wiki::Plugin::Base::Block::List - Base Class For UL / OL Block Plugin |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
base class for L and L |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SYNOPSIS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
use base qw(Text::Livedoor::Wiki::Plugin::Base::Block::List) |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 FUNCTION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 list |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
create list |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 AUTHOR |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
polocky |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |