lib/Markdown/Parser/Abbr.pm

filter: Statementstmt 50.0% 23 / 46 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 8 / 14 Podpod 100% 6 / 6 totaltotal 51.3% 37 / 72 CC 4 SCAR 17.5
CC
4
Cov
44%
as_string
20.0
init
2.0
as_markdown
2.0
CRAP 5.8
« blib/lib/Markdown/Parser/Abbr.pm ↑ Summary lib/Markdown/Parser/HTML.pm »
1 ## -*- perl -*-
2 ##----------------------------------------------------------------------------
3 ## Markdown Parser Only - ~/lib/Markdown/Parser/Abbr.pm
4 ## Version v0.2.0
5 ## Copyright(c) 2021 DEGUEST Pte. Ltd.
6 ## Author: Jacques Deguest <jack@deguest.jp>
7 ## Created 2021/08/23
8 ## Modified 2022/09/19
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::Abbr;
15 BEGIN
16 {
17 1 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶ use parent qw( Markdown::Parser::Element );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶ use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶ use Devel::Confess;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶ our $VERSION = 'v0.2.0';
Subroutine BEGIN: called CC=1 SCAR=0.0
23 };
24  
25 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 sub init
29 {
30 0 ▶ my $self = shift( @_ );
Subroutine init: not called CC=1 SCAR=6.9
Pod documented
31 0 $self->{name} = '';
32 0 $self->{tag_name} = 'abbr';
33 0 $self->{value} = '';
34 0 return( $self->SUPER::init( @_ ) );
35 }
36  
37 sub as_markdown
38 {
39 0 ▶ my $self = shift( @_ );
Subroutine as_markdown: not called CC=1 SCAR=6.9
Pod documented
40 0 return( sprintf( 'C<%s>: %s', $self->name, $self->value ) );
41 }
42  
43 sub as_pod
44 {
45 0 ▶ my $self = shift( @_ );
Subroutine as_pod: not called CC=1 SCAR=6.9
Pod documented
46 0 return( sprintf( '*[%s]: %s', $self->name, $self->value ) );
47 }
48  
49 sub as_string
50 {
51 0 ▶ my $self = shift( @_ );
Subroutine as_string: not called CC=4 SCAR=30.0
Pod documented
52 0 my $val = $self->value->scalar;
53 0 $self->encode_html( [qw( < > & " ' )], \$val );
54 0 my $tag_open = $self->tag_name;
55 0 my $arr = $self->new_array;
56 0 $arr->push( "<${tag_open}" );
57 0 ▶ $arr->push( $self->format_id ) if( $self->id->length );
Branch: 1 branch
BranchTrueFalseTotal
if $self->id->length 0 0 0
58 0 ▶ $arr->push( $self->format_class ) if( $self->class->length );
Branch: 1 branch
BranchTrueFalseTotal
if $self->class->length 0 0 0
59 0 $arr->push( sprintf( 'title="%s"', $val ) );
60 0 my $attributes = $self->format_attributes;
61 0 ▶ $arr->push( $attributes->join( ' ' )->scalar ) if( $attributes->length );
Branch: 1 branch
BranchTrueFalseTotal
if $attributes->length 0 0 0
62 # e.g. <abbr title="Hyper Text Markup Language">HTML</abbr>
63 0 return( sprintf( '%s>%s</abbr>', $arr->join( ' ' )->scalar, $self->name->scalar ) );
64 }
65  
66 0 ▶sub name { return( shift->_set_get_scalar_as_object( 'name', @_ ) ); }
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
67  
68 0 ▶sub value { return( shift->_set_get_scalar_as_object( 'value', @_ ) ); }
Subroutine value: not called CC=1 SCAR=6.9
Pod documented
69  
70 1 1;
71 # NOTE: POD
72 __END__
« blib/lib/Markdown/Parser/Abbr.pm ↑ Summary lib/Markdown/Parser/HTML.pm »