| 1 | package Text::Livedoor::Wiki::Plugin::Inline::WikiPage; | ||||||||||||
| 2 | |||||||||||||
| 3 | 10 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 10 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 10 | ▶ | use base qw(Text::Livedoor::Wiki::Plugin::Inline); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 10 | ▶ | use Text::Livedoor::Wiki::Utils; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 10 | __PACKAGE__->regex(q{\[\[((?:[^>\]]+>{1,3})?)([^\]]+)\]\]}); | |||||||||||
| 9 | 10 | __PACKAGE__->n_args(2); | |||||||||||
| 10 | |||||||||||||
| 11 | 4 | ▶ | sub process { | ||||||||||
|
Subroutine
process: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||
| 12 | 4 | my ( $class , $inline , $label , $pagename ) = @_; | |||||||||||
| 13 | 4 | ▶ | if( $label ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 14 | 2 | $label =~ s/>$//; | |||||||||||
| 15 | } | ||||||||||||
| 16 | else { | ||||||||||||
| 17 | 2 | $label = $pagename; | |||||||||||
| 18 | } | ||||||||||||
| 19 | 4 | $label = Text::Livedoor::Wiki::Utils::escape( $label ); | |||||||||||
| 20 | 4 | ▶ | if ( $pagename =~ /^(http|https|ftp):\/\// ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 21 | 2 | my $url = Text::Livedoor::Wiki::Utils::escape($pagename); | |||||||||||
| 22 | 2 | return qq|<a href="$url" class="outlink">$label</a>|; | |||||||||||
| 23 | } | ||||||||||||
| 24 | else { | ||||||||||||
| 25 | 2 | $pagename = Text::Livedoor::Wiki::Utils::sanitize_uri($pagename); | |||||||||||
| 26 | 2 | ▶ | my $base_url = $class->opts->{inline_wikipage_base_url} || '/'; | ||||||||||
|
Condition50%1/2
$class->opts->{'inline_wikipage_base_url'} || '/'
MC/DC0%0/1
$class->opts->{'inline_wikipage_base_url'} || '/'
$class->opts->{'inline_wikipage_base_url'}
Truth table50%1/2
A
A= $class->opts->{'inline_wikipage_base_url'}
| |||||||||||||
| 27 | 2 | return qq|<a href="$base_url$pagename">$label</a>|; | |||||||||||
| 28 | } | ||||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | 10 | 1; | |||||||||||
| 32 | |||||||||||||
| 33 | =head1 NAME | ||||||||||||
| 34 | |||||||||||||
| 35 | Text::Livedoor::Wiki::Plugin::Inline::WikiPage - wikipage link Inline Plugin | ||||||||||||
| 36 | |||||||||||||
| 37 | =head1 DESCRIPTION | ||||||||||||
| 38 | |||||||||||||
| 39 | wikipage link. do start with http:// ;-p | ||||||||||||
| 40 | |||||||||||||
| 41 | =head1 SYNOPSIS | ||||||||||||
| 42 | |||||||||||||
| 43 | [[PageName]] | ||||||||||||
| 44 | [[Page Name Label>PageName]] | ||||||||||||
| 45 | [[livedoor wiki>http://wiki.livedoor.com]] | ||||||||||||
| 46 | |||||||||||||
| 47 | =head1 opts | ||||||||||||
| 48 | |||||||||||||
| 49 | =head2 inline_wikipage_base_url | ||||||||||||
| 50 | |||||||||||||
| 51 | you can set base URL | ||||||||||||
| 52 | |||||||||||||
| 53 | =head1 FUNCTION | ||||||||||||
| 54 | |||||||||||||
| 55 | =head2 process | ||||||||||||
| 56 | |||||||||||||
| 57 | =head1 AUTHOR | ||||||||||||
| 58 | |||||||||||||
| 59 | polocky | ||||||||||||
| 60 | |||||||||||||
| 61 | =cut | ||||||||||||