| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Text::Livedoor::Wiki::Plugin::Function::Color; |
|
2
|
11
|
|
|
11
|
|
61
|
use warnings; |
|
|
11
|
|
|
|
|
24
|
|
|
|
11
|
|
|
|
|
342
|
|
|
3
|
11
|
|
|
11
|
|
57
|
use strict; |
|
|
11
|
|
|
|
|
21
|
|
|
|
11
|
|
|
|
|
343
|
|
|
4
|
11
|
|
|
11
|
|
58
|
use base qw/Text::Livedoor::Wiki::Plugin::Function/; |
|
|
11
|
|
|
|
|
18
|
|
|
|
11
|
|
|
|
|
3787
|
|
|
5
|
|
|
|
|
|
|
__PACKAGE__->function_name('color'); |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub prepare_args { |
|
8
|
17
|
|
|
17
|
1
|
28
|
my $class = shift; |
|
9
|
17
|
|
|
|
|
26
|
my $args = shift; |
|
10
|
17
|
100
|
|
|
|
59
|
die 'no args' unless scalar @$args; |
|
11
|
|
|
|
|
|
|
|
|
12
|
16
|
|
|
|
|
29
|
my $color = $args->[0]; |
|
13
|
16
|
|
|
|
|
23
|
my $bgcolor = $args->[1]; |
|
14
|
16
|
|
|
|
|
27
|
my $my_args = {}; |
|
15
|
|
|
|
|
|
|
|
|
16
|
16
|
100
|
|
|
|
39
|
if( $color ) { |
|
17
|
13
|
100
|
|
|
|
110
|
die 'color is not web color' unless $color =~ /^[a-zA-Z0-9#]+$/i; |
|
18
|
12
|
|
|
|
|
37
|
$my_args->{color} = $color; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
15
|
100
|
|
|
|
39
|
if( $bgcolor ) { |
|
22
|
8
|
100
|
|
|
|
44
|
die 'bgcolor is not web color' unless $bgcolor=~ /^[a-zA-Z0-9#]+$/i; |
|
23
|
7
|
|
|
|
|
16
|
$my_args->{bgcolor} = $bgcolor; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
14
|
|
|
|
|
41
|
return $my_args; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
sub process { |
|
28
|
9
|
|
|
9
|
1
|
20
|
my ( $class, $inline, $data ) = @_; |
|
29
|
9
|
|
|
|
|
15
|
my $str_color = ''; |
|
30
|
9
|
|
|
|
|
12
|
my $str_bgcolor = ''; |
|
31
|
|
|
|
|
|
|
|
|
32
|
9
|
100
|
|
|
|
28
|
if( my $color = $data->{args}{color} ) { |
|
33
|
7
|
|
|
|
|
19
|
$str_color = "color:$color;"; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
9
|
100
|
|
|
|
30
|
if( my $bgcolor = $data->{args}{bgcolor} ) { |
|
37
|
5
|
|
|
|
|
11
|
$str_bgcolor = "background-color:$bgcolor;"; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
9
|
|
|
|
|
21
|
my $style = qq{style="$str_color$str_bgcolor"}; |
|
41
|
9
|
|
|
|
|
31
|
my $value = $inline->parse( $data->{value} ); |
|
42
|
9
|
|
|
|
|
76
|
return "$value"; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub process_mobile { |
|
47
|
5
|
|
|
5
|
1
|
8
|
my ( $class, $inline, $data ) = @_; |
|
48
|
5
|
|
|
|
|
9
|
my $str_color =''; |
|
49
|
5
|
|
|
|
|
6
|
my $str_bgcolor = ''; |
|
50
|
|
|
|
|
|
|
|
|
51
|
5
|
100
|
|
|
|
15
|
if( my $color = $data->{args}{color} ) { |
|
52
|
4
|
|
|
|
|
10
|
$str_color = qq| color="$color"|; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
5
|
100
|
|
|
|
14
|
if( my $bgcolor = $data->{args}{bgcolor} ) { |
|
56
|
2
|
|
|
|
|
5
|
$str_bgcolor = qq| style="background-color:$bgcolor"|; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
5
|
|
|
|
|
15
|
my $value = $inline->parse( $data->{value} ); |
|
60
|
5
|
|
|
|
|
35
|
return (qq|$value|); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 NAME |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Text::Livedoor::Wiki::Plugin::Function::Color - Color Function Plugin |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
customize font color. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
&color(red){red} |
|
76
|
|
|
|
|
|
|
&color(,red){back ground red} |
|
77
|
|
|
|
|
|
|
&color(red,black){ red text and block background} |
|
78
|
|
|
|
|
|
|
&color(#ffffff,#000000){hey hey} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 FUNCTION |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 prepare_args |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 process |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 process_mobile |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 AUTHOR |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
polocky |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |