| 1 | package Text::Livedoor::Wiki::Plugin::Inline; | ||
| 2 | |||
| 3 | 12 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 12 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 12 | ▶ | use base qw(Class::Data::Inheritable); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 12 | ▶ | use Text::Livedoor::Wiki::Utils; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 12 | __PACKAGE__->mk_classdata('regex'); | |
| 9 | 12 | __PACKAGE__->mk_classdata('n_args'); | |
| 10 | 12 | __PACKAGE__->mk_classdata('dependency'); | |
| 11 | |||
| 12 | 2 | ▶ | sub process { die 'implement me' } |
|
Subroutine
process: called CC=1 SCAR=0.0
Pod
documented
| |||
| 13 | 21 | ▶ | sub process_mobile { shift->process(@_) } |
|
Subroutine
process_mobile: called CC=1 SCAR=0.0
Pod
documented
| |||
| 14 | |||
| 15 | 3 | ▶ | sub uid { |
|
Subroutine
uid: called CC=1 SCAR=0.0
Pod
documented
| |||
| 16 | 3 | return $Text::Livedoor::Wiki::scratchpad->{core}{inline_uid}; | |
| 17 | } | ||
| 18 | 5 | ▶ | sub opts { |
|
Subroutine
opts: called CC=1 SCAR=0.0
Pod
documented
| |||
| 19 | 5 | return $Text::Livedoor::Wiki::opts; | |
| 20 | } | ||
| 21 | 12 | 1; | |
| 22 | |||
| 23 | =head1 NAME | ||
| 24 | |||
| 25 | Text::Livedoor::Wiki::Plugin::Inline - Inline Plugin Base Class | ||
| 26 | |||
| 27 | =head1 DESCRIPTION | ||
| 28 | |||
| 29 | you can use this class as base to create Inline Plugin. | ||
| 30 | |||
| 31 | =head1 SYNOPSIS | ||
| 32 | |||
| 33 | package Text::Livedoor::Wiki::Plugin::Inline::Del; | ||
| 34 | |||
| 35 | use warnings; | ||
| 36 | use strict; | ||
| 37 | use base qw(Text::Livedoor::Wiki::Plugin::Inline); | ||
| 38 | |||
| 39 | __PACKAGE__->regex(q{%%([^%]*)%%}); | ||
| 40 | __PACKAGE__->n_args(1); | ||
| 41 | __PACKAGE__->dependency( 'Text::Livedoor::Wiki::Plugin::Inline::Underbar' ); | ||
| 42 | |||
| 43 | sub process { | ||
| 44 | my ( $class , $inline , $line ) = @_; | ||
| 45 | $line = $inline->parse($line); | ||
| 46 | return "<del>$line</del>"; | ||
| 47 | } | ||
| 48 | 1; | ||
| 49 | |||
| 50 | =head1 FUNCTION | ||
| 51 | |||
| 52 | =head2 regex | ||
| 53 | |||
| 54 | set regex for your inline formatter rule | ||
| 55 | |||
| 56 | =head2 n_args | ||
| 57 | |||
| 58 | set how many args you take | ||
| 59 | |||
| 60 | =head2 dependency | ||
| 61 | |||
| 62 | set dependency plugin which must check before your plugin | ||
| 63 | |||
| 64 | =head2 process | ||
| 65 | |||
| 66 | return HTML you want to display | ||
| 67 | |||
| 68 | =head2 process_mobile | ||
| 69 | |||
| 70 | If you did not use it, then $class->process() is run. | ||
| 71 | |||
| 72 | =head2 uid | ||
| 73 | |||
| 74 | get unique id | ||
| 75 | |||
| 76 | =head2 opts | ||
| 77 | |||
| 78 | get opts | ||
| 79 | |||
| 80 | =head1 AUTHOR | ||
| 81 | |||
| 82 | polocky | ||
| 83 | |||
| 84 | =cut | ||