| 1 | package Markapl::TagHandlers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 22 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 22 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 22 | ▶ | use Devel::Declare (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 22 | ▶ | use B::Hooks::EndOfScope; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 22 | ▶ | use HTML::Entities; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 22 | our $VERSION = 0.03; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 22 | our ($Declarator, $Offset); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 227 | ▶ | sub skip_declarator { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
skip_declarator: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 227 | $Offset += Devel::Declare::toke_move_past_token($Offset); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1135 | ▶ | sub skipspace { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
skipspace: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1135 | $Offset += Devel::Declare::toke_skipspace($Offset); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 227 | ▶ | sub strip_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
strip_name: called CC=2 SCAR=10.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 227 | skipspace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 227 | ▶ | if (my $len = Devel::Declare::toke_scan_word($Offset, 1)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | my $linestr = Devel::Declare::get_linestr(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | my $name = substr($linestr, $Offset, $len); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | substr($linestr, $Offset, $len) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | Devel::Declare::set_linestr($linestr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | return $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 227 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 227 | ▶ | sub strip_proto { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
strip_proto: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 227 | skipspace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 227 | my $linestr = Devel::Declare::get_linestr(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 227 | ▶ | if (substr($linestr, $Offset, 1) eq '(') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 60 | my $length = Devel::Declare::toke_scan_str($Offset); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 60 | my $proto = Devel::Declare::get_lex_stuff(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 60 | Devel::Declare::clear_lex_stuff(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 60 | $linestr = Devel::Declare::get_linestr(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 60 | substr($linestr, $Offset, $length) = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 60 | Devel::Declare::set_linestr($linestr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 60 | return $proto; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 167 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 227 | ▶ | sub shadow { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
shadow: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 227 | my $pack = Devel::Declare::get_curstash_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 227 | Devel::Declare::shadow_sub("${pack}::${Declarator}", $_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | sub make_proto_unwrap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_proto_unwrap: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | my ($proto) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | return (defined($proto) && length($proto)) ? "($proto);" : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $proto and length $proto
MC/DC0%0/2
defined $proto and length $proto
defined $proto
length $proto
Truth table0%0/3
A and B
A= defined $protoB= length $proto
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 227 | ▶ | sub inject_if_block { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inject_if_block: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 227 | my $inject = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 227 | skipspace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 227 | my $linestr = Devel::Declare::get_linestr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 227 | ▶ | if (substr($linestr, $Offset, 1) eq '{') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 211 | substr($linestr, $Offset+1, 0) = $inject; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 211 | Devel::Declare::set_linestr($linestr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 227 | ▶ | sub inject_before_block { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inject_before_block: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 227 | my $inject = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 227 | skipspace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 227 | my $linestr = Devel::Declare::get_linestr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 227 | ▶ | if (substr($linestr, $Offset, 1) eq '{') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 227 | substr($linestr, $Offset, 0) = $inject; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 227 | Devel::Declare::set_linestr($linestr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 227 | ▶ | sub inject_empty_block { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inject_empty_block: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 227 | my $inject = "{}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 227 | skipspace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 227 | my $linestr = Devel::Declare::get_linestr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 227 | ▶ | if (substr($linestr, $Offset, 1) eq ';') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 16 | substr($linestr, $Offset, 0) = $inject; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 16 | Devel::Declare::set_linestr($linestr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 211 | ▶ | sub inject_scope { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inject_scope: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 211 | ▶ | on_scope_end { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 211 | my $linestr = Devel::Declare::get_linestr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 211 | my $offset = Devel::Declare::get_linestr_offset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 211 | substr($linestr, $offset, 0) = ';'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 211 | Devel::Declare::set_linestr($linestr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 211 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 22 | my %alt = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 'cell' => 'td', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 'row' => 'tr', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 'html_base' => 'base', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 'html_link' => 'link', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 'html_map' => 'map', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 'html_q' => 'q', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 'html_s' => 's', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 'html_sub' => 'sub', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 'html_tr' => 'tr', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 22 | ▶ | use String::BufferStack; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 109 | ▶ | sub _tag { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tag: called CC=9 SCAR=22.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 109 | my ($tag, $attr, $block, $in_closure) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 109 | my $original_buffer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 109 | ▶ | if ($in_closure) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 2 | $original_buffer = Markapl->buffer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | Markapl->buffer( String::BufferStack->new( out_method => sub { join("", @_) }) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | Markapl->buffer->push; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 109 | ▶ | if (grep { $tag eq $_ } Markapl::Tags->html_inline) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 9 | Markapl->buffer->append("<${tag}${attr}>"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 100 | Markapl->buffer->append("<${tag}${attr}>"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | Markapl->buffer->append( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | join '', map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 100 | ▶ | ref($_) && $_->isa('Markapl::Tag') ? $_->() : ($_||"") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition62%5/8
defined $block and ref $block eq "CODE"
ref $_ and $_->isa("Markapl::Tag")
$_ or ""
MC/DC0%0/2
defined $block and ref $block eq "CODE"
defined $block
ref $block eq "CODE"
MC/DC50%1/2
ref $_ and $_->isa("Markapl::Tag")
ref $_
$_->isa("Markapl::Tag")
MC/DC100%1/1
$_ or ""
$_
Truth table33%1/3
A and B
A= defined $blockB= ref $block eq "CODE"
Truth table66%2/3
A and B
A= ref $_B= $_->isa("Markapl::Tag")
Truth table100%2/2
A
A= $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } $block->() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | ) if defined $block && ref($block) eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 100 | Markapl->buffer->append("</$tag>"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 109 | ▶ | if ($original_buffer) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 2 | my $output = Markapl->buffer->pop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 2 | Markapl->buffer($original_buffer); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 2 | return $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 107 | return ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 2726 | ▶ | sub tag_parser_for { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tag_parser_for: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 2726 | my ($tag) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 2726 | ▶ | $tag = $alt{$tag} if defined($alt{$tag}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 227 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 227 | local ($Declarator, $Offset) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 227 | my $offset_before = $Offset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 227 | skip_declarator; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # This means that current declarator is in a hash key. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # Don't shadow sub in this case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 227 | ▶ | return if $Offset == $offset_before; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 227 | my $name = strip_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 227 | my $proto = strip_proto; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 227 | inject_if_block("BEGIN { Markapl::TagHandlers::inject_scope };"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 227 | inject_empty_block; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 227 | ▶ | if (defined($proto)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 60 | inject_before_block("$proto, sub"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 167 | inject_before_block("sub"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | shadow( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 109 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 109 | my $block = pop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 109 | my @attr = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 109 | my $attr = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 109 | ▶ | if (@attr == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 4 | my $css = $attr[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 4 | ▶ | while ($css =~ /([\#\.])([A-Za-z][-:\.\w]*)/g) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 4 | ▶ | if ($1 eq '#') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | $attr .= qq{ id="$2"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 3 | $attr .= qq{ class="$2"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 105 | my ($k, $v) = (shift @attr, shift @attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 105 | ▶ | while ($k) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 25 | ▶ | if (defined $v) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 24 | $v = encode_entities($v, '<>&"'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 24 | $attr .= " $k=\"$v\""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 1 | $attr .= " $k"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 25 | ($k, $v) = (shift @attr, shift @attr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 109 | ▶ | if (defined wantarray and not wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined wantarray and not wantarray
MC/DC100%2/2
defined wantarray and not wantarray
defined wantarray
not wantarray
Truth table100%3/3
A and not(B)
A= defined wantarrayB= not wantarray
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 2 | ▶ | my $sub = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 2 | _tag($tag, $attr, $block, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 2 | bless $sub, 'Markapl::Tag'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 2 | return $sub; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 107 | _tag($tag, $attr, $block); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 107 | return ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 227 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 2726 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 22 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||