| 1 | package Text::Livedoor::Wiki::Plugin::Block::H5; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | 185 | ▶ | sub check { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check: called CC=10 SCAR=23.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 185 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 185 | my $line = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 185 | my $args = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 185 | my $id = $args->{id}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 185 | my $inline = $args->{inline}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 185 | my $on_next = $args->{on_next}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 185 | my $scratchpad = $Text::Livedoor::Wiki::scratchpad; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 185 | my $catalog_keeper = $Text::Livedoor::Wiki::opts->{catalog_keeper}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 185 | my $id_keeper = $Text::Livedoor::Wiki::opts->{id_keeper}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 185 | my $skip_catalog = $Text::Livedoor::Wiki::opts->{skip_catalog}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 185 | my $key = 'h5_is_active_' . $id; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 185 | ▶ | if ( $line =~ /^\*\*\*/ && !$scratchpad->{$key} && !$class->get_child($id) ){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition83%5/6
$line =~ /^\*\*\*/ and not $scratchpad->{$key} and not $class->get_child($id)
$line =~ /^\*\*\*/ and not $scratchpad->{$key}
MC/DC66%2/3
$line =~ /^\*\*\*/ and not $scratchpad->{$key} and not $class->get_child($id)
$line =~ /^\*\*\*/
not $scratchpad->{$key}
not $class->get_child($id)
Truth table75%3/4
A and not(B) and not(C)
A= $line =~ /^\*\*\*/B= not $scratchpad->{$key}C= not $class->get_child($id)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 15 | $scratchpad->{$key} = 1 ; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 15 | $line =~ s/^\*\*\*//; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 15 | my $title = $inline->parse($line); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 15 | my $header = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | #XXX | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 15 | $Text::Livedoor::Wiki::scratchpad->{skip_ajust_block_break} = '1'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 15 | ▶ | if( $skip_catalog ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | $header = sprintf( qq|<div class="title-3"><h5>%s</h5></div>\n| , $title ) ; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 14 | $id_keeper->up(3); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 14 | $catalog_keeper->append( {level=>3 , id => $id_keeper->id(3) , label => $title } ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 14 | $header = sprintf( qq|<div class="title-3"><h5 id="%s">%s</h5></div>\n| , $id_keeper->id(3) , $title ) ; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 15 | return { header => $header , id => $id }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | ▶ | elsif( $on_next && $class->trigger_check($id,$line) && $line =~ /^\*/ && $scratchpad->{$key} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition88%8/9
$on_next and $class->trigger_check($id, $line) and $line =~ /^\*/ and $scratchpad->{$key}
$on_next and $class->trigger_check($id, $line) and $line =~ /^\*/
$on_next and $class->trigger_check($id, $line)
MC/DC75%3/4
$on_next and $class->trigger_check($id, $line) and $line =~ /^\*/ and $scratchpad->{$key}
$on_next
$class->trigger_check($id, $line)
$line =~ /^\*/
$scratchpad->{$key}
Truth table80%4/5
A and B and C and D
A= $on_nextB= $class->trigger_check($id, $line)C= $line =~ /^\*/D= $scratchpad->{$key}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 9 | $scratchpad->{$key} = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 9 | return ; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | elsif( $scratchpad->{$key} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 20 | return { line => $line }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 141 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 15 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 15 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 15 | my $block = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 15 | my $inline = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 15 | my $items = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 15 | my $meta = shift @{$items}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 15 | my $header = $meta->{header} ; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 15 | my $id = $meta->{id} ; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 15 | my $html = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 15 | $html .= $_->{line} . "\n" for @$items; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 15 | $html =~ s/\n$//; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 15 | $html = $block->parse( $html , 1 ) ; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 15 | return qq|<div id="$id" class="wiki-section-3">\n$header<div id="$id-body" class="wiki-section-body-3">\n$html</div>\n</div>\n|; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | Text::Livedoor::Wiki::Plugin::Block::H5 - H5 Block Plugin | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | H5 is third level header | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | ** title3 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | content | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | ** title3 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | =head1 FUNCTION | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | =head2 check | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | =head2 get | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | polocky | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||