diff --git a/pae2xml.pl b/pae2xml.pl index 212fa61f10365ad09ce46dd3a55787992adb4bb4..c0ed6997d2af18b96ac5412ba4109349e48dd820 100755 --- a/pae2xml.pl +++ b/pae2xml.pl @@ -154,6 +154,16 @@ REST: $rest\n"; close OUT; } +# Repeat $1 by a count of $2 +sub repeat { + (my $e, my $count) = @_; + my $res = ""; + for (my $i=1; $i <= $count; ++$i) + { + $res .= $e; + } + return $res; +} sub parse_notes { my ($notes, $keysig) = @_; @@ -166,7 +176,7 @@ sub parse_notes { $notes = $1; } - $notes =~ s/!([^!]*)!/$1$1/gs; # write out repetitions + $notes =~ s/!([^!]*)!(f*)/repeat($1, length($2)+1)/gse; # write out repetitions $notes =~ s/\{([^\}]*)\}/$1/gs; # ignore beamings while ( $notes =~ s/(:?\/+:?|^)([^\/:]*)(:?\/+:?)i(:?\/+:?)/$1$2$3$2$4/gs) {}; # replace whole-measure repeats (i notation) diff --git a/sample_files/Shortcuts-repetition.pae b/sample_files/Shortcuts-repetition.pae new file mode 100644 index 0000000000000000000000000000000000000000..95577abdb84ce1e81eecf029a860610302d1f018 --- /dev/null +++ b/sample_files/Shortcuts-repetition.pae @@ -0,0 +1,7 @@ +Test Composer +Test case for repetitions +1.1.1: S repetitions +plain&easy: %C-1@c$bB� '4A!'6BG!fff4A/ + +Test Library +00000000 \ No newline at end of file