line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Livedoor::Wiki::Plugin::Inline::Function; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
70
|
use warnings; |
|
10
|
|
|
|
|
22
|
|
|
10
|
|
|
|
|
289
|
|
4
|
10
|
|
|
10
|
|
49
|
use strict; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
445
|
|
5
|
10
|
|
|
10
|
|
53
|
use base qw(Text::Livedoor::Wiki::Plugin::Inline); |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
1733
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->regex(q{([]([a-zA-Z]+)\([\s]*([^\)]*)\))((?:\{(?:[^\{\}]|(?:\{(?:[^\{\}]|(?:\{[^\{\}]*\}))*\}))*\})?)}); |
8
|
|
|
|
|
|
|
__PACKAGE__->n_args(4); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub process { |
11
|
152
|
|
|
152
|
1
|
443
|
my ( $class , $inline, $head_part, $function_name, $opr, $tail_part ) = @_; |
12
|
152
|
|
|
|
|
312
|
my $original = $head_part . $tail_part; |
13
|
152
|
100
|
|
|
|
1154
|
$tail_part = $1 if ( $tail_part =~ /^\{(.*)\}$/ ); |
14
|
|
|
|
|
|
|
# trim |
15
|
152
|
|
|
|
|
367
|
$opr =~ s/^\s+//; |
16
|
152
|
|
|
|
|
325
|
$opr =~ s/\s+$//; |
17
|
|
|
|
|
|
|
|
18
|
152
|
|
|
|
|
255
|
$tail_part =~ s/^\s+//; |
19
|
152
|
|
|
|
|
287
|
$tail_part =~ s/\s+$//; |
20
|
|
|
|
|
|
|
|
21
|
152
|
100
|
|
|
|
491
|
unless ( $inline->function->has_function( $function_name ) ) { |
22
|
1
|
|
|
|
|
5
|
return Text::Livedoor::Wiki::Utils::escape_more($original); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
151
|
|
|
|
|
947
|
my $data = $inline->function->prepare( $function_name , $opr , $tail_part ); |
26
|
151
|
100
|
|
|
|
368
|
unless( $data ) { |
27
|
25
|
|
|
|
|
99
|
return Text::Livedoor::Wiki::Utils::escape_more( $original ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
126
|
|
|
|
|
409
|
return $inline->function->parse( $function_name , $data ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 NAME |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Text::Livedoor::Wiki::Plugin::Inline::Function - Inline Function Plugin |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
This is a very special plugin which called function plugins. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SYNOPSIS |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
&functionname(){hoge} |
46
|
|
|
|
|
|
|
#functionname(){hoge} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 FUNCTION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 process |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 AUTHOR |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
polocky |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |