lib/Markdown/Parser/TableCaption.pm

filter: Statementstmt 42.5% 23 / 54 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 8 / 16 Podpod 100% 5 / 5 totaltotal 41.3% 36 / 87 CC 7 SCAR 21.7
CC
7
Cov
35%
as_string
30.0
as_markdown
6.0
as_pod
6.0
CRAP 8.7
« blib/lib/Markdown/Parser/TableCaption.pm ↑ Summary lib/Markdown/Parser/Paragraph.pm »
1 ##----------------------------------------------------------------------------
2 ## Markdown Parser Only - ~/lib/Markdown/Parser/TableCaption.pm
3 ## Version v0.2.0
4 ## Copyright(c) 2021 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2021/08/23
7 ## Modified 2022/09/19
8 ## All rights reserved
9 ##
10 ## This program is free software; you can redistribute it and/or modify it
11 ## under the same terms as Perl itself.
12 ##----------------------------------------------------------------------------
13 package Markdown::Parser::TableCaption;
14 BEGIN
15 {
16 1 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶ use parent qw( Markdown::Parser::Element );
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶ use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶ use Devel::Confess;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶ our $VERSION = 'v0.2.0';
Subroutine BEGIN: called CC=1 SCAR=0.0
22 };
23  
24 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 sub init
28 {
29 0 ▶ my $self = shift( @_ );
Subroutine init: not called CC=1 SCAR=6.9
Pod documented
30 0 $self->{position} = 'top';
31 0 $self->{tag_name} = 'caption';
32 0 return( $self->SUPER::init( @_ ) );
33 }
34  
35 sub as_markdown
36 {
37 0 ▶ my $self = shift( @_ );
Subroutine as_markdown: not called CC=2 SCAR=17.9
Pod documented
38 0 ▶ return( $self->{_as_markdown} ) if( $self->{_as_markdown} );
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_as_markdown"} 0 0 0
39 0 ▶ $self->{_as_markdown} = sprintf( ' [%s]', $self->children->map(sub{ $_->as_markdown })->join( '' )->scalar );
Subroutine __ANON__: not called CC=1 SCAR=6.9
40 0 return( $self->{_as_markdown} );
41 }
42  
43 sub as_pod
44 {
45 0 ▶ my $self = shift( @_ );
Subroutine as_pod: not called CC=2 SCAR=17.9
Pod documented
46 0 ▶ return( $self->{_as_pod} ) if( $self->{_as_pod} );
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_as_pod"} 0 0 0
47 0 ▶ $self->{_as_pod} = sprintf( ' [%s]', $self->children->map(sub{ $_->as_pod })->join( '' )->scalar );
Subroutine __ANON__: not called CC=1 SCAR=6.9
48 0 return( $self->{_as_pod} );
49 }
50  
51 sub as_string
52 {
53 0 ▶ my $self = shift( @_ );
Subroutine as_string: not called CC=5 SCAR=34.0
Pod documented
54 0 my $tag = $self->tag_name;
55 0 my $tag_open = $tag;
56 0 my $arr = $self->new_array;
57 0 $arr->push( "<$tag_open" );
58 0 my $attr = $self->new_array;
59 0 ▶ $attr->push( $self->format_id ) if( $self->id->length );
Branch: 1 branch
BranchTrueFalseTotal
if $self->id->length 0 0 0
60 0 ▶ $attr->push( $self->format_class ) if( $self->class->length );
Branch: 1 branch
BranchTrueFalseTotal
if $self->class->length 0 0 0
61 0 my $attributes = $self->format_attributes;
62 0 ▶ $attr->push( $attributes->join( ' ' )->scalar ) if( $attributes->length );
Branch: 1 branch
BranchTrueFalseTotal
if $attributes->length 0 0 0
63 0 ▶ $arr->push( ' ' . $attr->join( ' ' )->scalar ) if( $attr->length );
Branch: 1 branch
BranchTrueFalseTotal
if $attr->length 0 0 0
64 0 $arr->push( '>' );
65 0 ▶ $arr->push( $self->children->map(sub{ $_->as_string })->join( "\n" )->scalar );
Subroutine __ANON__: not called CC=1 SCAR=6.9
66 0 $arr->push( "</$tag>" );
67 0 return( $arr->join( '' )->scalar );
68 }
69  
70 ## 'top' or 'bottom' of the table
71 0 ▶sub position { return( shift->_set_get_scalar_as_object( 'position', @_ ) ); }
Subroutine position: not called CC=1 SCAR=6.9
Pod documented
72  
73 1 1;
74 # NOTE: POD
75 __END__
« blib/lib/Markdown/Parser/TableCaption.pm ↑ Summary lib/Markdown/Parser/Paragraph.pm »