line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Livedoor::Wiki::Plugin::Function::Lislog; |
2
|
11
|
|
|
11
|
|
92
|
use warnings; |
|
11
|
|
|
|
|
49
|
|
|
11
|
|
|
|
|
434
|
|
3
|
11
|
|
|
11
|
|
71
|
use strict; |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
367
|
|
4
|
11
|
|
|
11
|
|
62
|
use base qw/Text::Livedoor::Wiki::Plugin::Function/; |
|
11
|
|
|
|
|
34
|
|
|
11
|
|
|
|
|
2487
|
|
5
|
|
|
|
|
|
|
__PACKAGE__->function_name('lislog'); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub prepare_args { |
8
|
27
|
|
|
27
|
1
|
60
|
my $class= shift; |
9
|
27
|
|
|
|
|
39
|
my $args = shift; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# no args |
12
|
27
|
100
|
|
|
|
93
|
die 'no arg' unless scalar @$args ; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# not valid lislig url |
15
|
26
|
|
|
|
|
59
|
my $url = $args->[0]; |
16
|
|
|
|
|
|
|
|
17
|
26
|
100
|
|
|
|
198
|
die 'not valid url' unless $url =~ m{^http://(lislog|research.news)\.livedoor\.com/r/(\d+)}; |
18
|
24
|
|
|
|
|
131
|
my ($service, $listid ) = $url =~ m{^http://(lislog|research.news)\.livedoor\.com/r/(\d+)}; |
19
|
|
|
|
|
|
|
|
20
|
24
|
|
|
|
|
57
|
my $type = 'pie'; |
21
|
24
|
|
|
|
|
42
|
my $color = 'red'; |
22
|
24
|
|
|
|
|
56
|
for ( @$args ) { |
23
|
44
|
100
|
|
|
|
134
|
if ( $_ =~ /^(pie|bar)$/ ) { |
24
|
12
|
|
|
|
|
24
|
$type = $_; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
44
|
100
|
|
|
|
161
|
if ( $_ =~ /^(red|orange|yellow|lime|green|sky|blue|purple|pink|black)$/ ) { |
28
|
7
|
|
|
|
|
19
|
$color = $_; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# ok |
33
|
24
|
|
|
|
|
155
|
return { listid => $listid , type => $type , color => $color }; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
sub prepare_value { |
36
|
24
|
|
|
24
|
1
|
43
|
my $class = shift; |
37
|
24
|
|
|
|
|
34
|
my $value = shift; |
38
|
|
|
|
|
|
|
# no more large support but for legacy user |
39
|
24
|
100
|
|
|
|
91
|
$value = 'medium' if ( $value !~ m/^(?:small|medium|large)$/ ); |
40
|
24
|
100
|
|
|
|
74
|
$value = 'middle' if ( $value eq 'medium' ); # medium is middle.... >_< |
41
|
24
|
|
|
|
|
110
|
return { size => $value }; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub process { |
45
|
23
|
|
|
23
|
1
|
155
|
my ( $class, $inline, $data ) = @_; |
46
|
23
|
|
|
|
|
53
|
my $listid = $data->{args}{listid}; |
47
|
23
|
|
|
|
|
45
|
my $type = $data->{args}{type}; |
48
|
23
|
|
|
|
|
45
|
my $color = $data->{args}{color}; |
49
|
23
|
|
|
|
|
43
|
my $size = $data->{value}{size}; |
50
|
|
|
|
|
|
|
|
51
|
23
|
|
|
|
|
381
|
return qq||; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
1
|
1
|
7
|
sub process_mobile{ '' } |
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Text::Livedoor::Wiki::Plugin::Function::Lislog - Lislog Function Plugin |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
let's your choice. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SYNOPSIS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
&lislog(http://lislog.livedoor.com/r/20853) |
68
|
|
|
|
|
|
|
&lislog(http://research.news.livedoor.com/r/20853){small} |
69
|
|
|
|
|
|
|
&lislog(http://research.news.livedoor.com/r/20853){large} |
70
|
|
|
|
|
|
|
&lislog(http://research.news.livedoor.com/r/20853){medium} |
71
|
|
|
|
|
|
|
&lislog(http://research.news.livedoor.com/r/20853,bar) |
72
|
|
|
|
|
|
|
&lislog(http://research.news.livedoor.com/r/20853,bar,green) |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 FUNCTION |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 prepare_args |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 prepare_value |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 process |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 process_mobile |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 SEE ALSO |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
http://research.news.livedoor.com |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 AUTHOR |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
polocky |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |