lib/Text/Xatena/Node/Pre.pm

filter: Statementstmt 100% 26 / 26 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 92.5% 37 / 40 CC 4 SCAR 8.5
CC
4
Cov
97%
parse
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.3
« lib/Text/Xatena/Node/DefinitionList.pm ↑ Summary blib/lib/Text/Xatena/Inline/Base.pm »
1 package Text::Xatena::Node::Pre;
2  
3 19 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 19 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 19 ▶use base qw(Text::Xatena::Node::StopP);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 19 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 19 BEGINNING => qr/^>\|$/,
8 ENDOFNODE => qr/^(.*?)\|<$/,
9 19 };
10  
11 363 ▶sub parse {
Subroutine parse: called CC=4 SCAR=13.9
Pod undocumented
12 363 my ($class, $s, $parent, $stack) = @_;
13 363 ▶ if ($s->scan(BEGINNING)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($s->scan(qr/^>\|$/)) 7 356 363
14 7 my $node = $class->new;
15 7 push @$parent, $node;
16 7 push @$stack, $node;
17 7 return 1;
18 }
19  
20 356 ▶ if ($s->scan(ENDOFNODE)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($s->scan(qr/^(.*?)\|<$/)) 7 349 356
21 7 push @$parent, $s->matched->[1];
22 7 my $node = pop @$stack;
23 7 ▶ ref($node) eq $class or warn sprintf("syntax error: unmatched syntax got:%s expected:%s", ref($node), $class);
Branch: 1 branch
BranchTrueFalseTotal
ref $node eq $class or warn sprintf('syntax error: unmatched syntax got:%s expected:%s', ref $node, $class) 7 0 7
24 7 return 1;
25 }
26 }
27  
28 5 ▶sub as_html {
Subroutine as_html: called CC=1 SCAR=0.0
Pod undocumented
29 5 my ($self, $context, %opts) = @_;
30 5 $context->_tmpl(__PACKAGE__, q[
31 <pre>{{= $content }}</pre>
32 ], {
33 content => $self->SUPER::as_html($context, %opts, stopp => 1),
34 });
35 }
36  
37 19 1;
38 __END__
« lib/Text/Xatena/Node/DefinitionList.pm ↑ Summary blib/lib/Text/Xatena/Inline/Base.pm »