From dd0b2be18e5aeb5dbb802a8a7b9face268a8b21b Mon Sep 17 00:00:00 2001
From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Fri, 23 Jul 2010 00:56:17 +0200
Subject: [PATCH] Fix rhythmic model enclosed by beaming (pull beaming after
 the rhythmic model)

---
 pae2xml.pl                                              | 4 ++--
 sample_files/4-11d-Shortcuts-rhythmic-model-beaming.pae | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 sample_files/4-11d-Shortcuts-rhythmic-model-beaming.pae

diff --git a/pae2xml.pl b/pae2xml.pl
index 8957a84..1e2d280 100755
--- a/pae2xml.pl
+++ b/pae2xml.pl
@@ -256,6 +256,7 @@ sub parse_notes {
   $notes =~ s/(\.|\d|\,|\')qq/qq$1/gs; # pull beginning mark of group of grace notes in front of corresponding notes
   $notes =~ s/(xx|x|bb|b|n)qq/qq$1/gs;  # qq first, then parts of notes
   $notes =~ s/([\.\d,'xbn])+(q|g)/$2$1/gs; # q and g first, then parts of notes
+  $notes =~ s/(\{)(\d\.*(\d\.*)+)/$2$1/gs; # pull beaming inside a rhythmic model
 
   # Beam starts/endings are handled by the first/last note of the beam, since
   # we need to know for the first note the <beam>begin</beam> and for the
@@ -424,8 +425,7 @@ sub parse_notes {
     }
     elsif ($notes =~ s/(\d+\.*)\(({?(g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?}?)\)/\($1$2\)/gs) { # pull duration into fermata parentheses
       #      print "after replacement: $notes\n"; exit;
-    }
-    elsif ($notes =~ /^ +(.*)$/) {
+    } elsif ($notes =~ /^ +(.*)$/) {
       $notes = $1;
       print("Invalid space encountered in notes before $notes\n");
     }
diff --git a/sample_files/4-11d-Shortcuts-rhythmic-model-beaming.pae b/sample_files/4-11d-Shortcuts-rhythmic-model-beaming.pae
new file mode 100644
index 0000000..9322e0e
--- /dev/null
+++ b/sample_files/4-11d-Shortcuts-rhythmic-model-beaming.pae
@@ -0,0 +1,8 @@
+Test Composer
+Test case for a rhythmic model with enclosing beaming
+1.1.1: S rhythmic model with enclosing beaming
+plain&easy: %G-2@c$xFC� {8.6''FADD}{DFEG}/{FA}{DD}
+
+pae2xml Test Suite 4-11d-Shortcuts-rhythmic-model-beaming
+4-11d-Shortcuts-rhythmic-model-beaming
+
-- 
GitLab