| 1 | package Text::Livedoor::Wiki::Plugin::Function; | ||
| 2 | 12 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 12 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 12 | ▶ | use base qw(Class::Data::Inheritable); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 12 | __PACKAGE__->mk_classdata('function_name'); | |
| 6 | 12 | __PACKAGE__->mk_classdata('operation_regexp'); | |
| 7 | |||
| 8 | 2 | ▶ | sub process { die 'implement me' } |
|
Subroutine
process: called CC=1 SCAR=0.0
Pod
documented
| |||
| 9 | 3 | ▶ | sub process_mobile { shift->process(@_) } |
|
Subroutine
process_mobile: called CC=1 SCAR=0.0
Pod
documented
| |||
| 10 | 6 | ▶ | sub prepare_args { |
|
Subroutine
prepare_args: called CC=1 SCAR=0.0
Pod
documented
| |||
| 11 | 6 | my $class= shift; | |
| 12 | 6 | my $args = shift; | |
| 13 | 6 | return $args; | |
| 14 | } | ||
| 15 | 58 | ▶ | sub prepare_value { |
|
Subroutine
prepare_value: called CC=1 SCAR=0.0
Pod
documented
| |||
| 16 | 58 | my $class = shift; | |
| 17 | 58 | my $value = shift; | |
| 18 | 58 | return $value; | |
| 19 | } | ||
| 20 | |||
| 21 | 2 | ▶ | sub uid { |
|
Subroutine
uid: called CC=1 SCAR=0.0
Pod
documented
| |||
| 22 | 2 | return $Text::Livedoor::Wiki::scratchpad->{core}{inline_uid}; | |
| 23 | } | ||
| 24 | 15 | ▶ | sub opts { |
|
Subroutine
opts: called CC=1 SCAR=0.0
Pod
documented
| |||
| 25 | 15 | return $Text::Livedoor::Wiki::opts; | |
| 26 | } | ||
| 27 | 12 | 1; | |
| 28 | |||
| 29 | |||
| 30 | =head1 NAME | ||
| 31 | |||
| 32 | Text::Livedoor::Wiki::Plugin::Function - Base Class For Function Plugin | ||
| 33 | |||
| 34 | =head1 DESCRIPTION | ||
| 35 | |||
| 36 | you can use this class as base to create Function Plugin. | ||
| 37 | |||
| 38 | =head1 SYNOPSIS | ||
| 39 | |||
| 40 | package Text::Livedoor::Wiki::Plugin::Function::Superscript; | ||
| 41 | |||
| 42 | use warnings; | ||
| 43 | use strict; | ||
| 44 | use base qw/Text::Livedoor::Wiki::Plugin::Function/; | ||
| 45 | __PACKAGE__->function_name('sup'); | ||
| 46 | |||
| 47 | sub process { | ||
| 48 | my ( $class, $inline, $data ) = @_; | ||
| 49 | my $value = $data->{value}; | ||
| 50 | $value = $inline->parse( $value ); | ||
| 51 | return "<sup>$value</sup>"; | ||
| 52 | } | ||
| 53 | |||
| 54 | 1; | ||
| 55 | |||
| 56 | &function_name(argument_here){value here} | ||
| 57 | |||
| 58 | =head1 FUNCTION | ||
| 59 | |||
| 60 | =head2 function_name | ||
| 61 | |||
| 62 | you can specify your function name. | ||
| 63 | |||
| 64 | =head2 process | ||
| 65 | |||
| 66 | you must implement your self . return text what you want for your plugin. | ||
| 67 | |||
| 68 | =head2 process_mobile | ||
| 69 | |||
| 70 | if you did not implement this ,then $class->process() is used. | ||
| 71 | |||
| 72 | =head2 prepare_args | ||
| 73 | |||
| 74 | you can validate argument with this function. | ||
| 75 | |||
| 76 | =head2 prepare_value | ||
| 77 | |||
| 78 | you can validate value with this function. | ||
| 79 | |||
| 80 | =head2 uid | ||
| 81 | |||
| 82 | get unique id | ||
| 83 | |||
| 84 | =head2 opts | ||
| 85 | |||
| 86 | get option hash data | ||
| 87 | |||
| 88 | =head1 AUTHOR | ||
| 89 | |||
| 90 | polocky | ||
| 91 | |||
| 92 | =cut | ||