Parser/Insertion.pm

filter: Statementstmt 57.4% 27 / 47 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 10 / 14 Podpod 100% 4 / 4 totaltotal 54.6% 41 / 75 CC 6 SCAR 26.5
CC
6
Cov
47%
as_string
42.0
as_pod
2.0
__ANON__
2.0
CRAP 14.1
« Parser/Superscript.pm ↑ Summary Parser/StrikeThrough.pm »
1 ## -*- perl -*-
2 ##----------------------------------------------------------------------------
3 ## Markdown Parser Only - ~/lib/Markdown/Parser/Insertion.pm
4 ## Version v0.3.0
5 ## Copyright(c) 2022 DEGUEST Pte. Ltd.
6 ## Author: Jacques Deguest <jack@deguest.jp>
7 ## Created 2021/08/23
8 ## Modified 2024/08/30
9 ## All rights reserved
10 ##
11 ## This program is free software; you can redistribute it and/or modify it
12 ## under the same terms as Perl itself.
13 ##----------------------------------------------------------------------------
14 package Markdown::Parser::Insertion;
15 BEGIN
16 2 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶ use parent qw( Markdown::Parser::Element );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶ use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 our $VERSION = 'v0.3.0';
22 };
23  
24 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 sub init
28 1 ▶{
Subroutine init: called CC=1 SCAR=0.0
Pod documented
29 1 my $self = shift( @_ );
30 1 $self->{tag_name} = 'ins';
31 1 return( $self->SUPER::init( @_ ) );
32 }
33  
34 sub as_markdown
35 1 ▶{
Subroutine as_markdown: called CC=1 SCAR=0.0
Pod documented
36 1 my $self = shift( @_ );
37 1 ▶ my $str = $self->children->map(sub{ $_->as_markdown })->join( '' );
Subroutine __ANON__: called CC=1 SCAR=0.0
38 1 return( "++${str}++" );
39 }
40  
41 sub as_pod
42 0 ▶{
Subroutine as_pod: not called CC=1 SCAR=6.9
Pod documented
43 0 my $self = shift( @_ );
44 0 ▶ my $str = $self->children->map(sub{ $_->as_markdown })->join( '' );
Subroutine __ANON__: not called CC=1 SCAR=6.9
45 0 return( "${str}" );
46 }
47  
48 sub as_string
49 0 ▶{
Subroutine as_string: not called CC=6 SCAR=37.4
Pod documented
50 0 my $self = shift( @_ );
51 0 my $arr = $self->new_array;
52 0 my $tag = $self->tag_name;
53 0 my $tag_open = $tag;
54 0 $arr->push( "<${tag_open}" );
55 0 my $attr = $self->new_array;
56 0 ▶ $attr->push( $self->format_id ) if( $self->id->length );
Branch: 1 branch
BranchTrueFalseTotal
if $self->id->length 0 0 0
57 0 ▶ $attr->push( $self->format_class ) if( $self->class->length );
Branch: 1 branch
BranchTrueFalseTotal
if $self->class->length 0 0 0
58 0 my $attributes = $self->format_attributes;
59 0 ▶ $attr->push( $attributes->join( ' ' )->scalar ) if( $attributes->length );
Branch: 1 branch
BranchTrueFalseTotal
if $attributes->length 0 0 0
60 0 ▶ $arr->push( ' ' . $attr->join( ' ' )->scalar ) if( $attr->length );
Branch: 1 branch
BranchTrueFalseTotal
if $attr->length 0 0 0
61 0 $arr->push( '>' );
62 0 ▶ $arr->push( $self->children->map(sub{ $_->as_string })->list ) if( $self->children->length );
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if $self->children->length 0 0 0
63 0 $arr->push( "</${tag}>" );
64 0 return( $arr->join( '' )->scalar );
65 }
66  
67 2 1;
68 # NOTE: POD
69 __END__
« Parser/Superscript.pm ↑ Summary Parser/StrikeThrough.pm »