Parser/FootnoteReference.pm

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