Wiki/Plugin/Block/DL.pm

filter: Statementstmt 100% 34 / 34 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 3 / 3 totaltotal 100% 45 / 45 CC 3 SCAR 4.1
CC
3
Cov
100%
check
2.0
get
2.0
BEGIN
1.0
CRAP 1.5
« Wiki/Plugin/Block/Line.pm ↑ Summary Wiki/Plugin/Inline/URL.pm »
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
BranchTrueFalseTotal
if (() = $line =~ /^:([^\|]*)\|(.*)/) 4 205 209
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
« Wiki/Plugin/Block/Line.pm ↑ Summary Wiki/Plugin/Inline/URL.pm »