| 1 | package Text::Trac::Dl; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 48 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 48 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 48 | ▶ | use base qw(Text::Trac::BlockNode); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 48 | our $VERSION = '0.23'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | sub init { | ||||||||||||||||||||||||||||
| 10 | 160 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | 160 | $self->pattern(qr/^\s+(.*)::$/xms); | |||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | sub parse { | ||||||||||||||||||||||||||||
| 15 | 3 | ▶ | my ( $self, $l ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
parse: called CC=9 SCAR=22.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 16 | 3 | my $c = $self->{context}; | |||||||||||||||||||||||||||
| 17 | 3 | my $pattern = $self->pattern; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 3 | ▶ | if ( !@{ $c->in_block_of } or $c->in_block_of->[-1] ne 'dl' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not @{$c->in_block_of;} or $c->in_block_of->[-1] ne "dl"
MC/DC0%0/2
not @{$c->in_block_of;} or $c->in_block_of->[-1] ne "dl"
not @{$c->in_block_of;}
$c->in_block_of->[-1] ne "dl"
Truth table33%1/3
not(A) or B
A= not @{$c->in_block_of;}B= $c->in_block_of->[-1] ne "dl"
| |||||||||||||||||||||||||||||
| 20 | 3 | $c->htmllines('<dl>'); | |||||||||||||||||||||||||||
| 21 | 3 | push @{ $c->in_block_of }, 'dl'; | |||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 3 | $c->unshiftline; | |||||||||||||||||||||||||||
| 25 | 3 | ▶ | while ( $c->hasnext ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 19 | ▶ | last if ( $c->nextline =~ /^$/ ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 19 | my $l = $c->shiftline; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 19 | ▶ | if ( $l =~ /$pattern/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 6 | ▶ | if ( $c->in_block_of->[-1] eq 'dd' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 3 | $l = "</dd>\n<dt>$1</dt>"; | |||||||||||||||||||||||||||
| 32 | 3 | pop @{ $c->in_block_of }; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | else { | ||||||||||||||||||||||||||||
| 35 | 3 | $l = "<dt>$1</dt>"; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | else { | ||||||||||||||||||||||||||||
| 39 | 13 | $l =~ s/^\s+//g; | |||||||||||||||||||||||||||
| 40 | 13 | ▶ | if ( $c->in_block_of->[-1] ne 'dd' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 6 | $l = "<dd>\n$l"; | |||||||||||||||||||||||||||
| 42 | 6 | push @{ $c->in_block_of }, 'dd'; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | 19 | $c->htmllines($l); | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 3 | ▶ | if ( $c->in_block_of->[-1] eq 'dd' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 3 | $c->htmllines('</dd>'); | |||||||||||||||||||||||||||
| 50 | 3 | pop @{ $c->in_block_of }; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 3 | pop @{ $c->in_block_of }; | |||||||||||||||||||||||||||
| 54 | 3 | $c->htmllines('</dl>'); | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 3 | return; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 48 | 1; | |||||||||||||||||||||||||||