Skip to content

Commit

Permalink
Fix 2, 2a, 2b verse merging
Browse files Browse the repository at this point in the history
  • Loading branch information
johnml1135 committed Jun 26, 2024
1 parent ceb586c commit 11060c4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/SIL.Machine/Corpora/UsfmTextUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,8 @@ private IReadOnlyList<string> AdvanceRows(IReadOnlyList<ScriptureRef> segScrRefs
if (compare == 0)
{
// source and row match
// grab the text and increment both
// grab the text - both source and row will be incremented in due time...
rowTexts.Add(text);
sourceIndex++;
break;
}
}
Expand Down
14 changes: 14 additions & 0 deletions tests/SIL.Machine.Tests/Corpora/UsfmTextUpdaterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,20 @@ public void GetUsfm_Verse_RangeMultipleRowsSingleVerse()
);
}

[Test]
public void GetUsfm_MergeVerseSegments()
{
var rows = new List<(IReadOnlyList<ScriptureRef>, string)>
{
(ScrRef("MAT 2:2"), "Verse 2."),
(ScrRef("MAT 2:2a"), "Verse 2a."),
(ScrRef("MAT 2:2b"), "Verse 2b.")
};

string target = UpdateUsfm(rows);
Assert.That(target, Contains.Substring("\\v 2-3 Verse 2. Verse 2a. Verse 2b.\r\n"));
}

[Test]
public void GetUsfm_Verse_OptBreak()
{
Expand Down

0 comments on commit 11060c4

Please sign in to comment.