diff --git a/src/ExportProcessors.mss b/src/ExportProcessors.mss index f4d70d0..04339ef 100644 --- a/src/ExportProcessors.mss +++ b/src/ExportProcessors.mss @@ -292,12 +292,10 @@ function ProcessLyric (lyricobj, objectPositions) { } } - syltext = libmei.GetText(sylel); - - if (utils.Pos('_', syltext) > -1) + if (utils.Pos('_', syl.Text) > -1) { // Syllable elision. split this syllable element by underscore. - syllables = MSplitString(syltext, '_'); + syllables = MSplitString(syl.Text, '_'); sylarray = CreateSparseArray(); // reset the text of the first syllable element to the first half of the syllable. diff --git a/test/mocha/test-lyrics.js b/test/mocha/test-lyrics.js index 56fc810..c4040eb 100644 --- a/test/mocha/test-lyrics.js +++ b/test/mocha/test-lyrics.js @@ -18,15 +18,19 @@ describe("Lyrics", () => { const syls = xpath.evaluateXPath('//*:syl', mei); describe("writes an elision", () => { - const elisionSyls = xpath.evaluateXPathToNodes('(//*:note)[1]//*:syl', mei); + const note1 = xpath.evaluateXPathToNodes('(//*:note)[1]', mei)[0]; + const note1Syls = xpath.evaluateXPathToNodes('.//*:syl', note1); it("exports 2 syllables for elisions", () => - assert.strictEqual(elisionSyls.length, 2) + assert.strictEqual(note1Syls.length, 2) ); it("sets @con='b' on first syl, but not any others", () => { - assert.strictEqual(elisionSyls[0].getAttribute('con'), 'b'); - const sylsWithCon = xpath.evaluateXPathToNodes('//*:syl[@con="b"]', mei); + assert.strictEqual(note1Syls[0].getAttribute('con'), 'b'); + const sylsWithCon = xpath.evaluateXPathToNodes('.//*:syl[@con="b"]', note1); assert.strictEqual(sylsWithCon.length, 1); }); + it("creates correct character entities on elisions", function() { + assert.strictEqual(syls[13].firstChild._data, "n'u"); + }); }); describe("wordpos", () => { diff --git a/test/sibmeiTestSibs/lyrics.sib b/test/sibmeiTestSibs/lyrics.sib index d810989..4229cad 100644 Binary files a/test/sibmeiTestSibs/lyrics.sib and b/test/sibmeiTestSibs/lyrics.sib differ