Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
johnml1135 authored Jul 11, 2024
1 parent b11f9a0 commit 385213e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions .ignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
!tests/SIL.Machine.Tests/Corpora/TestData/usfm/source/*
!tests/SIL.Machine.Tests/Corpora/TestData/usfm/target/*
!tests/SIL.Machine.Tests/Corpora/TestData/project/*
2 changes: 2 additions & 0 deletions src/SIL.Machine/Corpora/UsfmTextBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ public override void StartCell(UsfmParserState state, string marker, string alig
}
else if (CurrentTextType == ScriptureTextType.Verse)
{
if (_rowTexts.Count == 0)
return;
StringBuilder verseText = _rowTexts.Peek();
if (verseText.Length > 0 && !char.IsWhiteSpace(verseText[verseText.Length - 1]))
verseText.Append(" ");
Expand Down
21 changes: 21 additions & 0 deletions tests/SIL.Machine.Tests/Corpora/UsfmMemoryTextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,27 @@ public void GetRows_LastSegment()
});
}

[Test]
public void GetRows_DuplicateVerseWithTable()
{
TextRow[] rows = GetRows(
@"\id MAT - Test
\c 1
\v 1 First verse
\periph Table of Contents Abbreviation
\rem non verse content 1
\v 1 duplicate first verse
\rem non verse content 2
\mt1 Table
\tr \tc1 row 1 cell 1 \tc2 row 1 cell 2
\tr \tc1 row 2 cell 1 \tc2 row 2 cell 2
",
includeAllText: true
);

Assert.That(rows, Has.Length.EqualTo(5));
}

private static TextRow[] GetRows(string usfm, bool includeMarkers = false, bool includeAllText = false)
{
UsfmMemoryText text =
Expand Down

0 comments on commit 385213e

Please sign in to comment.