line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Livedoor::Wiki::Plugin::Function::Align; |
2
|
11
|
|
|
11
|
|
61
|
use warnings; |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
321
|
|
3
|
11
|
|
|
11
|
|
55
|
use strict; |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
332
|
|
4
|
11
|
|
|
11
|
|
53
|
use base qw/Text::Livedoor::Wiki::Plugin::Function/; |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
1398
|
|
5
|
|
|
|
|
|
|
__PACKAGE__->function_name('align'); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub prepare_args { |
8
|
7
|
|
|
7
|
1
|
14
|
my $class = shift; |
9
|
7
|
|
|
|
|
16
|
my $args = shift; |
10
|
7
|
100
|
|
|
|
40
|
die 'no args' unless scalar @$args; |
11
|
6
|
|
|
|
|
16
|
my $align = $args->[0]; |
12
|
6
|
100
|
|
|
|
75
|
die 'invalid value for alignment.' unless $align =~ /^(left|right|center)$/i; |
13
|
4
|
|
|
|
|
25
|
return { align => lc $align }; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub process { |
17
|
4
|
|
|
4
|
1
|
10
|
my ( $class, $inline, $data ) = @_; |
18
|
4
|
|
|
|
|
11
|
my $align = $data->{args}{align}; |
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
|
|
12
|
my $style = qq{style="text-align:$align;"}; |
21
|
4
|
|
|
|
|
17
|
my $value = $inline->parse( $data->{value} ); |
22
|
4
|
|
|
|
|
35
|
return " $value "; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Text::Livedoor::Wiki::Plugin::Function::Align - Align Function Plugin |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 DESCRIPTION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
change text alignment. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 SYNOPSIS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
&align(right){Here are some words.} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 FUNCTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 prepare_args |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 process |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 AUTHOR |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
oklahomer |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |