| 1 | #! perl | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | package main; | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 5 | our $options; | |||||||||||||||||||||||||||||||||||||||||
| 6 | 5 | our $config; | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | package ChordPro::Output::ChordPro; | ||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 5 | ▶ | use v5.26; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 5 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 5 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 5 | ▶ | use feature qw( signatures ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 5 | ▶ | no warnings "experimental::signatures"; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 5 | ▶ | use ChordPro::Output::Common; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 5 | ▶ | use ChordPro::Utils qw( fq qquote demarkup is_true is_ttrue ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 5 | ▶ | use Ref::Util qw( is_arrayref ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 5 | my $re_meta; | |||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 23 | ▶ | sub generate_songbook ( $self, $sb ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate_songbook: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | # Skip empty songbooks. | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 23 | ▶ | return [] unless eval { $sb->{songs}->[0]->{body} }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | # Build regex for the known metadata items. | ||||||||||||||||||||||||||||||||||||||||||
| 28 | $re_meta = join( '|', | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 23 | map { quotemeta } | |||||||||||||||||||||||||||||||||||||||||
| 30 | "title", "subtitle", | ||||||||||||||||||||||||||||||||||||||||||
| 31 | "artist", "composer", "lyricist", "arranger", | ||||||||||||||||||||||||||||||||||||||||||
| 32 | "album", "copyright", "year", | ||||||||||||||||||||||||||||||||||||||||||
| 33 | "key", "time", "tempo", "capo", "duration" ); | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 23 | $re_meta = qr/^($re_meta)$/; | |||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 23 | my @book; | |||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 23 | foreach my $song ( @{$sb->{songs}} ) { | |||||||||||||||||||||||||||||||||||||||||
| 39 | 26 | ▶ | if ( @book ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 3 | ▶ | push(@book, "") if $options->{'backend-option'}->{tidy}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 3 | push(@book, "{new_song}"); | |||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 26 | push(@book, @{generate_song($song)}); | |||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 23 | push( @book, ""); | |||||||||||||||||||||||||||||||||||||||||
| 47 | 23 | \@book; | |||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 5 | my $lyrics_only = 0; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 5 | my $variant = 'cho'; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 5 | my $rechorus; | |||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 26 | ▶ | sub upd_config () { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
upd_config: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 26 | $rechorus = $::config->{chordpro}->{chorus}->{recall}; | |||||||||||||||||||||||||||||||||||||||||
| 56 | 26 | $lyrics_only = 2 * $::config->{settings}->{'lyrics-only'}; | |||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 26 | ▶ | sub generate_song ( $s ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate_song: called CC=133 SCAR=77.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 26 | my $tidy = $options->{'backend-option'}->{tidy}; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 26 | ▶ | my $structured = ( $options->{'backend-option'}->{structure} // '' ) eq 'structured'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$main::options->{"backend-option"}{"structure"} // ""
MC/DC0%0/1
$main::options->{"backend-option"}{"structure"} // ""
$main::options->{"backend-option"}{"structure"}
Truth table50%1/2
A
A= $main::options->{"backend-option"}{"structure"}
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | # $s->structurize if ++$structured; | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 26 | ▶ | $variant = $options->{'backend-option'}->{variant} || 'cho'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$main::options->{'backend-option'}{'variant'} || 'cho'
MC/DC0%0/1
$main::options->{'backend-option'}{'variant'} || 'cho'
$main::options->{'backend-option'}{'variant'}
Truth table50%1/2
A
A= $main::options->{'backend-option'}{'variant'}
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 26 | my $seq = $options->{'backend-option'}->{seq}; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 26 | my $expand = $options->{'backend-option'}->{expand}; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 26 | my $msp = $variant eq "msp"; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 26 | my $movable = ChordPro::Chords::Parser->get_parser($s->{system})->movable; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 26 | upd_config(); | |||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 26 | my @s; | |||||||||||||||||||||||||||||||||||||||||
| 72 | my %imgs; | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 26 | ▶ | if ( $s->{preamble} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | @s = @{ $s->{preamble} }; | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | push(@s, "{title: " . fq($s->{meta}->{title}->[0]) . "}") | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 26 | ▶ | if defined $s->{meta}->{title}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 26 | ▶ | if ( defined $s->{subtitle} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 6 | push(@s, map { +"{subtitle: ".fq($_)."}" } @{$s->{subtitle}}); | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 26 | ▶ | if ( $s->{meta} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 26 | ▶ | if ( $msp ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | $s->{meta}->{source} //= [ "Lead Sheet" ]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$s->{"meta"}{"source"} //= ["Lead Sheet"]
MC/DC0%0/1
$s->{"meta"}{"source"} //= ["Lead Sheet"]
$s->{"meta"}{"source"}
Truth table0%0/2
A
A= $s->{"meta"}{"source"}
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | $s->{meta}->{custom2} //= [ $seq ] if defined $seq; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$s->{"meta"}{"custom2"} //= [$seq]
MC/DC0%0/1
$s->{"meta"}{"custom2"} //= [$seq]
$s->{"meta"}{"custom2"}
Truth table0%0/2
A
A= $s->{"meta"}{"custom2"}
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | # Known ones 'as is'. | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 26 | my %used; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 26 | foreach my $k ( sort keys %{ $s->{meta} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 92 | 197 | ▶ | next if $k =~ /^(?:title|subtitle|key)$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 157 | ▶ | if ( $k =~ $re_meta ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | 3 | $used{$k}++; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 3 | push( @s, map { +"{$k: ".fq($_)."}" } @{ $s->{meta}->{$k} } ); | |||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | # Unknowns with meta prefix. | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 26 | foreach my $k ( sort keys %{ $s->{meta} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 100 | 197 | ▶ | next if $used{$k}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 194 | ▶ | next if $k =~ /^(?:title|subtitle|songindex|key.*|chords|numchords)$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 60 | ▶ | next if $k =~ /^_/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 26 | ▶ | next if $k =~ /\./; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 26 | ▶ | next if $k =~ /^bookmark/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | push( @s, map { +"{meta: $k ".fq($_)."}" } @{ $s->{meta}->{$k} } ); | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 26 | ▶ | if ( $s->{settings} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 26 | foreach ( sort keys %{ $s->{settings} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 111 | 16 | ▶ | if ( $_ eq "diagrams" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 3 | ▶ | next if $s->{settings}->{diagrampos}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 2 | my $v = $s->{settings}->{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 2 | ▶ | if ( is_ttrue($v) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $v = "on"; | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | elsif ( is_true($v) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | $v = "off"; | |||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | push(@s, "{diagrams: $v}"); | |||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | elsif ( $_ eq "diagrampos" ) { | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 1 | my $v = $s->{settings}->{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 1 | push(@s, "{diagrams: $v}"); | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 12 | push(@s, "{$_: " . $s->{settings}->{$_} . "}"); | |||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | 26 | ▶ | push(@s, "") if $tidy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | # Move a trailing list of chords to the beginning, so the chords | ||||||||||||||||||||||||||||||||||||||||||
| 137 | # are defined when the song is parsed. | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 26 | ▶ | if ( @{ $s->{body} } && $s->{body}->[-1]->{type} eq "diagrams" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
@{$s->{"body"};} and $s->{"body"}[-1]{"type"} eq "diagrams" and $s->{"body"}[-1]{"origin"} ne "__CLI__"
@{$s->{"body"};} and $s->{"body"}[-1]{"type"} eq "diagrams"
MC/DC0%0/3
@{$s->{"body"};} and $s->{"body"}[-1]{"type"} eq "diagrams" and $s->{"body"}[-1]{"origin"} ne "__CLI__"
@{$s->{"body"};}
$s->{"body"}[-1]{"type"} eq "diagrams"
$s->{"body"}[-1]{"origin"} ne "__CLI__"
Truth table25%1/4
A and B and C
A= @{$s->{"body"};}B= $s->{"body"}[-1]{"type"} eq "diagrams"C= $s->{"body"}[-1]{"origin"} ne "__CLI__"
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | && $s->{body}->[-1]->{origin} ne "__CLI__" | ||||||||||||||||||||||||||||||||||||||||||
| 140 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | unshift( @{ $s->{body} }, pop( @{ $s->{body} } ) ); | |||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 26 | ▶ | if ( $s->{define} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 9 | foreach my $info ( @{ $s->{define} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 146 | 27 | push( @s, define($info) ); | |||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 9 | ▶ | push(@s, "") if $tidy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 26 | ▶ | if ( $s->{spreadimage} && $variant eq "msp" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$s->{"spreadimage"} and $variant eq "msp"
MC/DC0%0/2
$s->{"spreadimage"} and $variant eq "msp"
$s->{"spreadimage"}
$variant eq "msp"
Truth table33%1/3
A and B
A= $s->{"spreadimage"}B= $variant eq "msp"
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my $a = $s->{assets}->{$s->{spreadimage}->{id}}; | |||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if ( $a->{delegate} =~ /^abc$/i && !$a->{uri} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$a->{"delegate"} =~ /^abc$/iu and not $a->{"uri"}
MC/DC0%0/2
$a->{"delegate"} =~ /^abc$/iu and not $a->{"uri"}
$a->{"delegate"} =~ /^abc$/iu
not $a->{"uri"}
Truth table0%0/3
A and not(B)
A= $a->{"delegate"} =~ /^abc$/iuB= not $a->{"uri"}
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | push( @s, "{start_of_" . lc($a->{delegate}) . "}", | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | @{$a->{data}}, | |||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | "{end_of_" . lc($a->{delegate}) . "}" ); | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 26 | my $ctx = ""; | |||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 26 | my @elts = @{$s->{body}}; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 26 | ▶ | while ( @elts ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 318 | my $elt = shift(@elts); | |||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 318 | ▶ | if ( $elt->{context} ne $ctx ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 30 | ▶ | push(@s, "{end_of_$ctx}") if $ctx; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 30 | $ctx = $elt->{context}; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 30 | ▶ | if ( $ctx ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | 18 | my $t = "{start_of_$ctx"; | |||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 18 | ▶ | if ( $elt->{type} eq "set" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 4 | ▶ | if ( $elt->{name} eq "gridparams" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | 2 | my @gridparams = @{ $elt->{value} }; | |||||||||||||||||||||||||||||||||||||||||
| 176 | 2 | $t .= ": "; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 2 | ▶ | $t .= $gridparams[2] . "+" if $gridparams[2]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 2 | $t .= $gridparams[0]; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 2 | ▶ | $t .= "x" . $gridparams[1] if $gridparams[1]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 2 | ▶ | $t .= "+" . $gridparams[3] if $gridparams[3]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 2 | ▶ | if ( $gridparams[4] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | my $tag = $gridparams[4]; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | $t .= " " . $tag if $tag ne ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 186 | elsif ( $elt->{name} eq "label" ) { | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 2 | my $tag = $elt->{value}; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 2 | ▶ | if ( $variant eq "msp" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $tag =~ s/\s+/ /g; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | $t .= ": " . $tag if $tag ne ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 2 | $tag =~ s/\n/\\n/g; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 2 | ▶ | $t .= " label=\"" . $tag . "\"" if $tag ne ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 18 | $t .= "}"; | |||||||||||||||||||||||||||||||||||||||||
| 200 | 18 | push( @s, $t ); | |||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 18 | ▶ | if ( $ctx =~ /^abc$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | if ( $elt->{id} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | push( @s, @{$s->{assets}->{$elt->{id}}->{data}} ); | |||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | pop(@s); | |||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $ctx = ''; | |||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | elsif ( $ctx =~ /^textblock$/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | push( @s, @{$s->{assets}->{$elt->{id}}->{data}} ); | |||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 318 | ▶ | if ( $elt->{type} eq "empty" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 61 | ▶ | push(@s, "***SHOULD NOT HAPPEN***"), next | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | if $structured; | ||||||||||||||||||||||||||||||||||||||||||
| 223 | 61 | push( @s, "" ); | |||||||||||||||||||||||||||||||||||||||||
| 224 | 61 | next; | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 257 | ▶ | if ( $elt->{type} eq "colb" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 3 | ▶ | next if $msp; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | 3 | push(@s, "{column_break}"); | |||||||||||||||||||||||||||||||||||||||||
| 230 | 3 | next; | |||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 254 | ▶ | if ( $elt->{type} eq "newpage" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 3 | ▶ | next if $msp; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 3 | push(@s, "{new_page}"); | |||||||||||||||||||||||||||||||||||||||||
| 236 | 3 | next; | |||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 251 | ▶ | if ( $elt->{type} eq "songline" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 119 | push(@s, songline( $s, $elt )); | |||||||||||||||||||||||||||||||||||||||||
| 241 | 119 | next; | |||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 132 | ▶ | if ( $elt->{type} eq "tabline" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 24 | push(@s, $elt->{text} ); | |||||||||||||||||||||||||||||||||||||||||
| 246 | 24 | next; | |||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 108 | ▶ | if ( $elt->{type} eq "gridline" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | 4 | push(@s, gridline( $s, $elt )); | |||||||||||||||||||||||||||||||||||||||||
| 251 | 4 | next; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 104 | ▶ | if ( $elt->{type} eq "verse" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | push(@s, "") if $tidy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | foreach my $e ( @{$elt->{body}} ) { | |||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | if ( $e->{type} eq "empty" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | push(@s, "***SHOULD NOT HAPPEN***"), next | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | if $structured; | ||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | if ( $e->{type} eq "song" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | push(@s, songline( $s, $e )); | |||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | push(@s, "") if $tidy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | 104 | ▶ | if ( $elt->{type} eq "chorus" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | ▶ | push(@s, "") if $tidy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | push(@s, "{start_of_chorus*}"); | |||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | foreach my $e ( @{$elt->{body}} ) { | |||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | if ( $e->{type} eq "empty" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | push(@s, ""); | |||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | if ( $e->{type} eq "songline" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | push(@s, songline( $s, $e )); | |||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | push(@s, "{end_of_chorus*}"); | |||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | push(@s, "") if $tidy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 104 | ▶ | if ( $elt->{type} eq "rechorus" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | if ( $msp ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | push( @s, "{chorus}" ); | |||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | elsif ( $rechorus->{quote} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | unshift( @elts, @{ $elt->{chorus} } ); | |||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 295 | ▶ | elsif ( $rechorus->{type} && $rechorus->{tag} ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$rechorus->{"type"} and $rechorus->{"tag"}
MC/DC0%0/2
$rechorus->{"type"} and $rechorus->{"tag"}
$rechorus->{"type"}
$rechorus->{"tag"}
Truth table0%0/3
A and B
A= $rechorus->{"type"}B= $rechorus->{"tag"}
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | push( @s, "{".$rechorus->{type}.": ".$rechorus->{tag}."}" ); | |||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||
| 298 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | push( @s, "{chorus}" ); | |||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 104 | ▶ | if ( $elt->{type} eq "tab" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | push(@s, "") if $tidy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | push(@s, "{start_of_tab}"); | |||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | push(@s, @{$elt->{body}}); | |||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | push(@s, "{end_of_tab}"); | |||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | push(@s, "") if $tidy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | 104 | ▶ | if ( $elt->{type} =~ /^comment(?:_italic|_box)?$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 25 | my $type = $elt->{type}; | |||||||||||||||||||||||||||||||||||||||||
| 315 | 25 | ▶ | my $text = $expand ? $elt->{text} : $elt->{orig}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 25 | ▶ | if ( $msp ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | $type = $type eq 'comment' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | ? 'highlight' | ||||||||||||||||||||||||||||||||||||||||||
| 319 | : $type eq 'comment_italic' | ||||||||||||||||||||||||||||||||||||||||||
| 320 | ? 'comment' | ||||||||||||||||||||||||||||||||||||||||||
| 321 | : $type; | ||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | # Flatten chords/phrases. | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 25 | ▶ | if ( $elt->{chords} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | $text = ""; | |||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | for ( 0..$#{ $elt->{chords} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 327 | $text .= "[" . fq(chord( $s, $elt->{chords}->[$_])) . "]" | ||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | if $elt->{chords}->[$_] ne ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | $text .= $elt->{phrases}->[$_]; | |||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||
| 332 | 25 | ▶ | $text = fmt_subst( $s, $text ) if $msp; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 25 | ▶ | push(@s, "") if $tidy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 25 | push(@s, "{$type: ".fq($text)."}"); | |||||||||||||||||||||||||||||||||||||||||
| 335 | 25 | ▶ | push(@s, "") if $tidy; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | 25 | next; | |||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 79 | ▶ | if ( $elt->{type} eq "image" && !$msp ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$elt->{"type"} eq "image" and not $msp
MC/DC0%0/2
$elt->{"type"} eq "image" and not $msp
$elt->{"type"} eq "image"
not $msp
Truth table33%1/3
A and not(B)
A= $elt->{"type"} eq "image"B= not $msp
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | my $uri = $s->{assets}->{$elt->{id}}->{uri}; | |||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | if ( $msp && $uri !~ /^id=/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$msp and not $uri =~ /^id=/u
MC/DC0%0/2
$msp and not $uri =~ /^id=/u
$msp
not $uri =~ /^id=/u
Truth table0%0/3
A and not(B)
A= $mspB= not $uri =~ /^id=/u
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | $imgs{$uri} //= keys(%imgs); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$imgs{$uri} //= keys %imgs
MC/DC0%0/1
$imgs{$uri} //= keys %imgs
$imgs{$uri}
Truth table0%0/2
A
A= $imgs{$uri}
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | $uri = sprintf("id=img%02d", $imgs{$uri}); | |||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | my @args = ( "image:", qquote($uri) ); | |||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | while ( my($k,$v) = each( %{ $elt->{opts} } ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | $v = join( ",",@$v ) if is_arrayref($v); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | push( @args, "$k=$v" ); | |||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | foreach ( @args ) { | |||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | next unless /\s/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $_ = '"' . $_ . '"'; | |||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | push( @s, "{@args}" ); | |||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | 79 | ▶ | if ( $elt->{type} eq "diagrams" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | 2 | for ( @{$elt->{chords}} ) { | |||||||||||||||||||||||||||||||||||||||||
| 360 | 2 | push( @s, define( $s->{chordsinfo}->{$_}, 1 ) ); | |||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 79 | ▶ | if ( $elt->{type} eq "set" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | 30 | ▶ | if ( $elt->{name} eq "lyrics-only" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 366 | $lyrics_only = $elt->{value} | ||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | unless $lyrics_only > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||
| 369 | elsif ( $elt->{name} eq "transpose" ) { | ||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||
| 371 | # Arbitrary config values. | ||||||||||||||||||||||||||||||||||||||||||
| 372 | elsif ( $elt->{name} =~ /^(chordpro\..+)/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | my @k = split( /[.]/, $1 ); | |||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | my $cc = {}; | |||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my $c = \$cc; | |||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | foreach ( @k ) { | |||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | $c = \($$c->{$_}); | |||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | $$c = $elt->{value}; | |||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $config->augment($cc); | |||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | upd_config(); | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | 30 | next; | |||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | 49 | ▶ | if ( $elt->{type} eq "control" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | if ( $elt->{name} =~ /^(\w+)-(size|color|font)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | my $t = "{$1$2: " . $elt->{value} . "}"; | |||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | push( @s, $t ) unless $t =~ s/^\{\Kchorus/text/r eq $s[-1]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | 49 | ▶ | if ( $elt->{type} eq "meta" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | 8 | ▶ | if ( $elt->{key} eq "key" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 396 | 8 | ▶ | next if $movable; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 8 | push( @s, "{key: " . $elt->{value}->[-1] . "}" ); | |||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||
| 399 | 8 | next; | |||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | 41 | ▶ | if ( $elt->{type} eq "ignore" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 403 | 39 | push( @s, $elt->{text} ); | |||||||||||||||||||||||||||||||||||||||||
| 404 | 39 | next; | |||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | 26 | ▶ | push(@s, "{end_of_$ctx}") if $ctx; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | 26 | my $did = 0; | |||||||||||||||||||||||||||||||||||||||||
| 412 | 26 | ▶ | if ( $s->{chords} && @{ $s->{chords}->{chords} } && $variant ne 'msp' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$s->{"chords"} and @{$s->{"chords"}{"chords"};} and $variant ne "msp"
$s->{"chords"} and @{$s->{"chords"}{"chords"};}
MC/DC66%2/3
$s->{"chords"} and @{$s->{"chords"}{"chords"};} and $variant ne "msp"
$s->{"chords"}
@{$s->{"chords"}{"chords"};}
$variant ne "msp"
Truth table75%3/4
A and B and C
A= $s->{"chords"}B= @{$s->{"chords"}{"chords"};}C= $variant ne "msp"
| |||||||||||||||||||||||||||||||||||||||||||
| 413 | 23 | for ( @{ $s->{chords}->{chords} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 414 | 70 | ▶ | last unless $s->{chordsinfo}->{$_}->parser->has_diagrams; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | 66 | ▶ | push( @s, "" ) unless $did++; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | 66 | push( @s, define( $s->{chordsinfo}->{$_}, 1 ) ); | |||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | # Process image assets. | ||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | foreach ( sort { $imgs{$a} <=> $imgs{$b} } keys %imgs ) { | |||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | my $url = $_; | |||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | my $id = $imgs{$url}; | |||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | my $type = "jpg"; | |||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | $type = lc($1) if $url =~ /\.(\w+)$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | require MIME::Base64; | |||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | require Image::Info; | |||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | # Slurp the image. | ||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | my $data = fs_blob($url); | |||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | unless ( defined $data ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | warn("$url: $!\n"); | |||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | # Get info. | ||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | my $info = Image::Info::image_info(\$data); | |||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | if ( $info->{error} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | do_warn($info->{error}); | |||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||
| 443 | # Write in-line data. | ||||||||||||||||||||||||||||||||||||||||||
| 444 | push( @s, | ||||||||||||||||||||||||||||||||||||||||||
| 445 | sprintf( "##image: id=img%02d" . | ||||||||||||||||||||||||||||||||||||||||||
| 446 | " src=%s type=%s width=%d height=%d enc=base64", | ||||||||||||||||||||||||||||||||||||||||||
| 447 | $id, $url, $info->{file_ext}, | ||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | $info->{width}, $info->{height} ) ); | |||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | $data = MIME::Base64::encode($data, ''); | |||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||
| 451 | # Note: 76 is the standard chunk size for base64 data. | ||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | while ( $i < length($data) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | push( @s, "# ".substr($data, $i, 76) ); | |||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | $i += 76; | |||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||
| 458 | 26 | \@s; | |||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||
| 461 | 119 | ▶ | sub songline ( $song, $elt ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
songline: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | 119 | ▶ | if ( $lyrics_only || !exists($elt->{chords}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$lyrics_only or not exists $elt->{"chords"}
MC/DC100%2/2
$lyrics_only or not exists $elt->{"chords"}
$lyrics_only
not exists $elt->{"chords"}
Truth table100%3/3
A or not(B)
A= $lyrics_onlyB= not exists $elt->{"chords"}
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | 40 | return fq(join( "", @{ $elt->{phrases} } )); | |||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 79 | my $line = ""; | |||||||||||||||||||||||||||||||||||||||||
| 468 | 79 | foreach my $c ( 0..$#{$elt->{chords}} ) { | |||||||||||||||||||||||||||||||||||||||||
| 469 | 226 | $line .= "[" . fq(chord( $song, $elt->{chords}->[$c])) . "]" . fq($elt->{phrases}->[$c]); | |||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||
| 471 | 79 | $line =~ s/^\[\]//; | |||||||||||||||||||||||||||||||||||||||||
| 472 | 79 | $line; | |||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | 4 | ▶ | sub gridline ( $song, $elt ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gridline: called CC=10 SCAR=31.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | 4 | my $line = ""; | |||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||
| 479 | 4 | ▶ | if ( $elt->{margin} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | $line .= fq( $elt->{margin}->{text} ); | |||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||
| 483 | 4 | for ( @{ $elt->{tokens} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 484 | 44 | ▶ | $line .= " " if $line; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 485 | 44 | ▶ | if ( $_->{class} eq "chord" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 486 | 10 | $line .= chord( $song, $_->{chord} ); | |||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||
| 488 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 489 | 34 | $line .= $_->{symbol}; | |||||||||||||||||||||||||||||||||||||||||
| 490 | 34 | ▶ | $line .= $_->{volta} if $_->{volta}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | 4 | ▶ | if ( $elt->{comment} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | ▶ | $line .= " " if $line; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | my $res = ""; | |||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | my $t = $elt->{comment}; | |||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | ▶ | if ( $t->{chords} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | for ( 0..$#{ $t->{chords} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | $res .= "[" . fq(chord( $song, $t->{chords}->[$_])) . "]" . fq($t->{phrases}->[$_]); | |||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||
| 503 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | $res .= fq($t->{text}); | |||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | $res =~ s/^\[\]//; | |||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | $line .= $res; | |||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||
| 510 | 4 | $line; | |||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||
| 513 | 236 | ▶ | sub chord ( $s, $c ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chord: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 514 | 236 | ▶ | return "" unless length($c); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 515 | 176 | local $c->info->{display} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 516 | 176 | local $c->info->{format} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 517 | 176 | my $t = $c->chord_display; | |||||||||||||||||||||||||||||||||||||||||
| 518 | 176 | ▶ | if ( $variant ne 'msp' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 519 | 176 | $t = demarkup($t); | |||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||
| 521 | 176 | ▶ | return "*$t" if $c->info->is_annotation; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 522 | 174 | return $t; | |||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||
| 525 | 95 | ▶ | sub define ( $info, $is_diag = 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
define: called CC=23 SCAR=35.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||
| 527 | 95 | ▶ | my $t = $is_diag ? "#{chord: " : "{define: "; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 528 | 95 | $t .= $info->{name}; | |||||||||||||||||||||||||||||||||||||||||
| 529 | 95 | ▶ | unless ( $is_diag ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 530 | 27 | ▶ | if ( $info->{copyall} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | $t .= " copyall " . qquote($info->{copyall}); | |||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||
| 533 | elsif ( $info->{copy} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | $t .= " copy " . qquote($info->{copy}); | |||||||||||||||||||||||||||||||||||||||||
| 535 | } | ||||||||||||||||||||||||||||||||||||||||||
| 536 | 27 | for ( qw( display ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 537 | 27 | ▶ | next unless defined $info->{$_}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 538 | 2 | $t .= " $_ " . qquote($info->{$_}->name ); | |||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||
| 540 | 27 | for ( qw( format ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 541 | 27 | ▶ | next unless defined $info->{$_}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 542 | 9 | my $x = qquote($info->{$_}, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 543 | 9 | $x =~ s/\%\{/\\%{/g; | |||||||||||||||||||||||||||||||||||||||||
| 544 | 9 | $t .= " $_ $x"; | |||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||
| 548 | 95 | ▶ | if ( $::config->{instrument}->{type} eq "keyboard" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 549 | $t .= " keys " . | ||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | join(" ", @{$info->{keys}}) | |||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | if $info->{keys} && @{$info->{keys}}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$info->{"keys"} and @{$info->{"keys"};}
MC/DC0%0/2
$info->{"keys"} and @{$info->{"keys"};}
$info->{"keys"}
@{$info->{"keys"};}
Truth table0%0/3
A and B
A= $info->{"keys"}B= @{$info->{"keys"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||
| 553 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 554 | 95 | $t .= " base-fret " . $info->{base}; | |||||||||||||||||||||||||||||||||||||||||
| 555 | $t .= " frets " . | ||||||||||||||||||||||||||||||||||||||||||
| 556 | 570 | ▶ | join(" ", map { $_ < 0 ? "N" : $_ } @{$info->{frets}}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 557 | 95 | ▶ | if $info->{frets}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 558 | $t .= " fingers " . | ||||||||||||||||||||||||||||||||||||||||||
| 559 | 432 | ▶ | join(" ", map { $_ < 0 ? "N" : $_ } @{$info->{fingers}}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 560 | 95 | ▶ | if $info->{fingers} && @{$info->{fingers}}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$info->{"fingers"} and @{$info->{"fingers"};}
MC/DC50%1/2
$info->{"fingers"} and @{$info->{"fingers"};}
$info->{"fingers"}
@{$info->{"fingers"};}
Truth table66%2/3
A and B
A= $info->{"fingers"}B= @{$info->{"fingers"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||
| 562 | 95 | ▶ | unless ( $is_diag ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 563 | 27 | for ( qw( diagram ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 564 | 27 | ▶ | next unless defined $info->{$_}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 565 | 3 | my $v = $info->{$_}; | |||||||||||||||||||||||||||||||||||||||||
| 566 | 3 | ▶ | if ( is_true($v) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | ▶ | if ( is_ttrue($v) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||
| 571 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 572 | 3 | $v = "off"; | |||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||
| 574 | 3 | $t .= " $_ $v"; | |||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||
| 578 | 95 | return $t . "}"; | |||||||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||
| 581 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||