Browse Source

fix(Lyrics): Read multiple text nodes separated by elision on single syllabic (#941)

fix #941
sschmid 4 years ago
parent
commit
1883ddd04e
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/MusicalScore/ScoreIO/MusicSymbolModules/LyricsReader.ts

+ 8 - 1
src/MusicalScore/ScoreIO/MusicSymbolModules/LyricsReader.ts

@@ -31,7 +31,14 @@ export class LyricsReader {
                             syllabic = lyricNode.element("syllabic").value;
                             syllabic = lyricNode.element("syllabic").value;
                         }
                         }
                         if (textNode) {
                         if (textNode) {
-                            const text: string = textNode.value;
+                            let text: string = "";
+                            const textAndElisionNodes: IXmlElement[] = lyricNode.elements();
+                            for (const node of textAndElisionNodes) {
+                                if (node.name === "text" || node.name === "elision") {
+                                    text += node.value;
+                                }
+                            }
+                            text = text.replace("  ", " "); // filter multiple spaces from concatenating e.g. "a " with elision " "
                             // <elision> separates Multiple syllabels on a single LyricNote
                             // <elision> separates Multiple syllabels on a single LyricNote
                             // "-" text indicating separated syllabel should be ignored
                             // "-" text indicating separated syllabel should be ignored
                             // we calculate the Dash element much later
                             // we calculate the Dash element much later