Skip to content

Commit

Permalink
Almost there
Browse files Browse the repository at this point in the history
  • Loading branch information
johnml1135 committed Feb 10, 2025
1 parent b8653ca commit 2f04cb1
Show file tree
Hide file tree
Showing 5 changed files with 307 additions and 115 deletions.
7 changes: 5 additions & 2 deletions src/SIL.Machine/Corpora/ScriptureRefUsfmParserHandlerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,10 @@ public bool InEmbed(string marker)

public bool IsInNestedEmbed(string marker)
{
return _inNestedEmbed || (marker.StartsWith("+") && marker.Length > 1 && IsEmbedPart(marker.Substring(1)));
return _inNestedEmbed
|| (
!(marker is null) && marker.StartsWith("+") && marker.Length > 1 && IsEmbedPart(marker.Substring(1))
);
}

private static bool IsNoteText(string marker)
Expand All @@ -400,7 +403,7 @@ public static bool IsEmbedPart(string marker)

private static bool IsEmbedCharacter(string marker)
{
return marker.IsOneOf("f", "fe", "fig", "fm", "x");
return !(marker is null) && marker.IsOneOf("f", "fe", "fig", "fm", "x");
}
}
}
11 changes: 5 additions & 6 deletions tests/SIL.Machine.Tests/Corpora/TestData/usfm/Tes/41MATTes.SFM
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
\id MAT - Test
\h Matthew
\mt Matthew
\ip An introduction to Matthew with an empty comment\fe + \ft \fe*
\ip An introduction to Matthew\fe + \ft This is an endnote.\fe*
\p \rq MAT 1\rq* Here is another paragraph.
\p and with a \w keyword|a special concept\w* in it.
\p and a \weirdtaglookingthing that is not an actual tag.
\c 1
\s Chapter One
\v 1 Chapter \pn one\+pro WON\+pro*\pn*, verse \f + \fr 1:1: \ft This is a footnote for v1.\f*one.
\v 1 Chapter \pn one\+pro WON\+pro*\pn*, verse one.\f + \fr 1:1: \ft This is a footnote for v1.\f*
\li1
\v 2 \bd C\bd*hapter one,
\li2 verse\f + \fr 1:2: \ft This is a footnote for v2.\f* two.
Expand All @@ -26,7 +26,7 @@
\s1 Chapter \it Two \it*
\p
\p
\v 1 Chapter \add two\add*, verse \f + \fr 2:1: \ft This is a \bd footnote.\bd*\f*one.
\v 1 Chapter \add two\add*, verse \f + \fr 2:1: \ft This is a footnote.\f*one.
\v 2-3 Chapter two, // verse \fm ∆\fm*two.
\esb
\ms This is a sidebar
Expand All @@ -37,9 +37,9 @@
\p
\v 6 Chapter two, verse \w six|strong="12345" \w*.
\p
\v 6 Bad verse. \x - \xo 2:3-4 \xt Cool Book 3:24 \xta The annotation \x* and more content.
\v 6 Bad verse. \x - \xo abc\xt 123\x* and more content.
\p
\v 5 Chapter two, verse five\rq (MAT 3:1)\rq*.
\v 5 Chapter two, verse five \rq (MAT 3:1)\rq*.
\v 7a Chapter two, verse seven A,
\s Section header \ts-s\*
\p
Expand All @@ -54,7 +54,6 @@
\v 11-12
\restore restore information
\c 3
\r (Mark 1:2-3; Luke 4:5-6)
\cl PSALM 3
\s1 Section 1
\mt1 Major Title 1
Expand Down
Loading

0 comments on commit 2f04cb1

Please sign in to comment.