Skip to content

Commit

Permalink
Break loop for empty neume section
Browse files Browse the repository at this point in the history
  • Loading branch information
yinanazhou committed Mar 18, 2024
1 parent 34e25e8 commit 59847c7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/utils/ConvertMei.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export function convertToNeon(staffBasedMei: string): string {
const mei = meiDoc.documentElement;
let nCol = 0;

for (const section of mei.querySelectorAll('section:not([type="neon-neume-line"])')) {
const sections = Array.from(mei.querySelectorAll('section:not([type="neon-neume-line"])'));
for (const section of sections) {
// Remove direct children pb elements within section
const pbs = section.querySelectorAll('pb');
pbs.forEach(pb => pb.remove());
Expand All @@ -78,6 +79,10 @@ export function convertToNeon(staffBasedMei: string): string {
for (const neonNeumeLineSection of neonNeumeLineSections) {
nStaff += 1;
const staff = neonNeumeLineSection.querySelector('staff');
if (!staff) {
neonNeumeLineSection.remove();
continue;
}
const layer = staff.querySelector('layer');

// if staff has a new type value,
Expand Down

0 comments on commit 59847c7

Please sign in to comment.