Skip to content

Commit

Permalink
Minor improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Serg-Norseman committed Aug 28, 2023
1 parent 30d7113 commit fbc47da
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
13 changes: 12 additions & 1 deletion projects/GKCore/GDModel/Providers/GEDCOM/GEDCOMUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ public static string ParseXRefPointer(string str, out string xref)
char chr = str[i];
if (chr == GEDCOMConsts.PointerDelimiter) {
if (init == -1) {
init = i;
if (i == strBeg) {
init = i;
}
} else {
fin = i;
xref = str.Substring(init + 1, fin - 1 - init);
Expand Down Expand Up @@ -477,6 +479,9 @@ public static string ParseRangeDate(GDMDateRange date, string strValue)
// Format: AFT DATE | BEF DATE | BET AFT_DATE AND BEF_DATE
public static string ParseRangeDate(GDMTree owner, GDMDateRange date, GEDCOMParser strTok)
{
/*GEDCOMFormat format = (owner == null) ? GEDCOMFormat.gf_Native : owner.Format;
bool isAQDeviance = (format == GEDCOMFormat.gf_AncestQuest);*/

strTok.SkipWhitespaces();

var token = strTok.CurrentToken;
Expand All @@ -494,10 +499,16 @@ public static string ParseRangeDate(GDMTree owner, GDMDateRange date, GEDCOMPars
ParseDate(owner, date.Before, strTok);
} else if (dateType == 2) { // "BET"
strTok.Next();

/*if (isAQDeviance && strTok.RequireSymbol('.')) {
strTok.Next();
}*/

ParseDate(owner, date.After, strTok);
strTok.SkipWhitespaces();

if (!strTok.RequireWord(GEDCOMConsts.GEDCOMDateRangeArray[3])) { // "AND"
//&& !(isAQDeviance && strTok.RequireSymbol('-'))) {
throw new GEDCOMRangeDateException(strTok.GetFullStr());
}

Expand Down
4 changes: 4 additions & 0 deletions projects/GKTests/GDModel/Providers/GEDCOM/GEDCOMUtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,10 @@ public void Test_ParseXRefPointer()
rest = GEDCOMUtils.ParseXRefPointer(null, out xref);
Assert.AreEqual("", rest);
Assert.AreEqual("", xref);

rest = GEDCOMUtils.ParseXRefPointer(" ... sample@email.com <sample@email.com>", out xref);
Assert.AreEqual("... sample@email.com <sample@email.com>", rest);
Assert.AreEqual("", xref);
}

[Test]
Expand Down
2 changes: 1 addition & 1 deletion projects/GKTests/Resources/test_aq.ged
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
1 CHIL @I4@
1 CHIL @I5@
1 MARR
2 DATE 1 JAN 1920
2 DATE BET 1 JAN 1920 AND 5 JAN 1920
0 @F2@ FAM
1 HUSB @I3@
1 WIFE @I6@
Expand Down

0 comments on commit fbc47da

Please sign in to comment.