lib/Markdown/Parser/FootnoteReference.pm

filter: Statementstmt 57.5% 23 / 40 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 53.3% 8 / 15 Podpod 100% 7 / 7 totaltotal 61.2% 38 / 62 CC 1 SCAR 3.8
CC
1
Cov
58%
init
2.0
as_markdown
2.0
as_pod
2.0
CRAP 1.5
« blib/lib/Markdown/Parser/Text.pm ↑ Summary lib/Markdown/Parser/Text.pm »
1 ## -*- perl -*-
2 ##----------------------------------------------------------------------------
3 ## Markdown Parser Only - ~/lib/Markdown/Parser/FootnoteReference.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::FootnoteReference;
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->{footnote} = '';
32 0 $self->{id} = '';
33 0 $self->{sequence} = '';
34 0 $self->{tag_name} = 'footnote_ref';
35 0 return( $self->SUPER::init( @_ ) );
36 }
37  
38 sub as_markdown
39 {
40 0 ▶ my $self = shift( @_ );
Subroutine as_markdown: not called CC=1 SCAR=6.9
Pod documented
41 0 return( sprintf( '*[%s]: %s', $self->name, $self->value ) );
42 }
43  
44 sub as_pod
45 {
46 0 ▶ my $self = shift( @_ );
Subroutine as_pod: not called CC=1 SCAR=6.9
Pod documented
47 0 return( sprintf( '[C<%s>]: %s', $self->name, $self->value ) );
48 }
49  
50 # <li id="fn:1" role="doc-endnote">
51 # <p>This is the first footnote.&nbsp;<a href="#fnref:1" class="reversefootnote" role="doc-backlink">↩</a></p>
52 # </li>
53 sub as_string
54 {
55 0 ▶ my $self = shift( @_ );
Subroutine as_string: not called CC=1 SCAR=6.9
Pod documented
56 0 my $val = $self->sequence->scalar;
57 0 $self->encode_html( [qw( < > & " ' )], \$val );
58 # e.g. <abbr title="Hyper Text Markup Language">HTML</abbr>
59 0 return( sprintf( '<sup id="fnref:%s"><a href="#fn:%s">%s</a></sup>', $self->id, $self->footnote->id, $val ) );
60 }
61  
62 ## The footnote object
63 0 ▶sub footnote { return( shift->_set_get_object( 'footnote', 'Markdown::Parser::Footnote', @_ ) ); }
Subroutine footnote: not called CC=1 SCAR=6.9
Pod documented
64  
65 ## The footnote reference own id for backlink, ie link from the footnote back to the point of reference
66 0 ▶sub id { return( shift->_set_get_scalar_as_object( 'name', @_ ) ); }
Subroutine id: not called CC=1 SCAR=6.9
Pod documented
67  
68 0 ▶sub sequence { return( shift->_set_get_scalar_as_object( 'sequence', @_ ) ); }
Subroutine sequence: not called CC=1 SCAR=6.9
Pod documented
69  
70 1 1;
71 # NOTE: POD
72 __END__
« blib/lib/Markdown/Parser/Text.pm ↑ Summary lib/Markdown/Parser/Text.pm »