| 1 | package Text::Livedoor::Wiki::Plugin::Block::DL; | ||||||||||
| 2 | |||||||||||
| 3 | 5 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 5 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 5 | ▶ | use base qw(Text::Livedoor::Wiki::Plugin::Block); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 209 | ▶ | sub check { | ||||||||
|
Subroutine
check: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 8 | 209 | my $class = shift; | |||||||||
| 9 | 209 | my $line = shift; | |||||||||
| 10 | 209 | my $args = shift; | |||||||||
| 11 | 209 | my $on_next = $args->{on_next}; | |||||||||
| 12 | 209 | my $id = $args->{id}; | |||||||||
| 13 | 209 | ▶ | if( my( $title , $description ) = $line =~ /^:([^\|]*)\|(.*)/ ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 4 | return { id => $id , title => $title , description => $description }; | |||||||||
| 15 | } | ||||||||||
| 16 | 205 | return; | |||||||||
| 17 | |||||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 2 | ▶ | sub get { | ||||||||
|
Subroutine
get: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 21 | 2 | my $class = shift; | |||||||||
| 22 | 2 | my $block = shift; | |||||||||
| 23 | 2 | my $inline = shift; | |||||||||
| 24 | 2 | my $items = shift; | |||||||||
| 25 | 2 | my $id = $items->[0]{id}; | |||||||||
| 26 | 2 | my $inlines = ''; | |||||||||
| 27 | 2 | for (@$items) { | |||||||||
| 28 | 3 | $inlines .= $class->item($inline, $_); | |||||||||
| 29 | } | ||||||||||
| 30 | 2 | return qq|<dl id="$id">\n$inlines</dl>\n|; | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 3 | ▶ | sub item { | ||||||||
|
Subroutine
item: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 34 | 3 | my $class = shift; | |||||||||
| 35 | 3 | my $inline = shift; | |||||||||
| 36 | 3 | my $item = shift; | |||||||||
| 37 | 3 | my $dt = $inline->parse( $item->{title} ); | |||||||||
| 38 | 3 | my $dd = $inline->parse( $item->{description} ); | |||||||||
| 39 | 3 | my $line = "<dt>$dt</dt><dd>$dd</dd>\n"; | |||||||||
| 40 | 3 | return $line; | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | |||||||||||
| 44 | 5 | 1; | |||||||||
| 45 | |||||||||||
| 46 | =head1 NAME | ||||||||||
| 47 | |||||||||||
| 48 | Text::Livedoor::Wiki::Plugin::Block::DL - Definition List Block Plugin | ||||||||||
| 49 | |||||||||||
| 50 | =head1 DESCRIPTION | ||||||||||
| 51 | |||||||||||
| 52 | Definition list | ||||||||||
| 53 | |||||||||||
| 54 | =head1 SYNOPSIS | ||||||||||
| 55 | |||||||||||
| 56 | :word|description here | ||||||||||
| 57 | :word|description here | ||||||||||
| 58 | :word|description here | ||||||||||
| 59 | |||||||||||
| 60 | =head1 FUNCTION | ||||||||||
| 61 | |||||||||||
| 62 | =head2 check | ||||||||||
| 63 | |||||||||||
| 64 | =head2 get | ||||||||||
| 65 | |||||||||||
| 66 | =head2 item | ||||||||||
| 67 | |||||||||||
| 68 | =head1 AUTHOR | ||||||||||
| 69 | |||||||||||
| 70 | polocky | ||||||||||
| 71 | |||||||||||
| 72 | =cut | ||||||||||