| 1 | package Text::Livedoor::Wiki::Plugin::Function::AName; | ||||||||||
| 2 | 11 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 11 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 11 | ▶ | use base qw/Text::Livedoor::Wiki::Plugin::Function/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 11 | __PACKAGE__->function_name('aname'); | |||||||||
| 6 | |||||||||||
| 7 | 4 | ▶ | sub prepare_args { | ||||||||
|
Subroutine
prepare_args: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 8 | 4 | my $class= shift; | |||||||||
| 9 | 4 | my $args = shift; | |||||||||
| 10 | 4 | ▶ | die 'no arg' unless scalar @$args ; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 11 | 3 | my $name = $args->[0]; | |||||||||
| 12 | # XXX is this regexp valid?? copy from old formatter | ||||||||||
| 13 | 3 | ▶ | die 'invalid format' unless $name =~ /^[a-zA-Z0-9\$\-_\.\+!\*'\(\),;\/\?:@&=]+$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 2 | return { name => $name }; | |||||||||
| 15 | } | ||||||||||
| 16 | 2 | ▶ | sub process { | ||||||||
|
Subroutine
process: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 17 | 2 | my ( $class, $inline, $data ) = @_; | |||||||||
| 18 | 2 | my $name = $data->{args}{name}; | |||||||||
| 19 | 2 | my $value = $data->{value}; | |||||||||
| 20 | 2 | $value = $inline->parse( $value ); | |||||||||
| 21 | 2 | return qq{<a class="anchor" id="$name" name="$name" title="$name">$value</a>}; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 11 | 1; | |||||||||
| 25 | |||||||||||
| 26 | =head1 NAME | ||||||||||
| 27 | |||||||||||
| 28 | Text::Livedoor::Wiki::Plugin::Function::AName - Aname Function Plugin | ||||||||||
| 29 | |||||||||||
| 30 | =head1 DESCRIPTION | ||||||||||
| 31 | |||||||||||
| 32 | anchor label where to jump | ||||||||||
| 33 | |||||||||||
| 34 | =head1 SYNOPSIS | ||||||||||
| 35 | |||||||||||
| 36 | [[target>>#my_a_name]] <- jump to my_a_name anchor | ||||||||||
| 37 | |||||||||||
| 38 | |||||||||||
| 39 | |||||||||||
| 40 | &aname(my_a_name){a name link label} | ||||||||||
| 41 | |||||||||||
| 42 | =head1 FUNCTION | ||||||||||
| 43 | |||||||||||
| 44 | =head2 prepare_args | ||||||||||
| 45 | |||||||||||
| 46 | =head2 process | ||||||||||
| 47 | |||||||||||
| 48 | =head1 AUTHOR | ||||||||||
| 49 | |||||||||||
| 50 | polocky | ||||||||||
| 51 | |||||||||||
| 52 | =cut | ||||||||||