All in one to be converted to json

This commit is contained in:
Mike Phares 2023-07-21 04:17:13 -07:00
parent 61f5fa20de
commit c8da883a88

View File

@ -405,9 +405,12 @@ internal abstract class PersonContainer
string personKeyFormatted;
string lowerHyphenFullName;
string pattern = "[^a-z0-9-]";
DateTime dateTime = new(ticks);
List<string> allFrontMatter = new();
Calendar calendar = new CultureInfo("en-US").Calendar;
Models.GenealogicalDataCommunication genealogicalDataCommunication;
GenealogicalDataCommunicationLines? genealogicalDataCommunicationLines;
string weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
ReadOnlyDictionary<string, string> personKeyFormattedToPersonFullName = GetPersonKeyFormattedToPersonFullName(personBirthdayFormat, personContainers);
ReadOnlyDictionary<int, List<GenealogicalDataCommunicationRelation>> familyIndexToCollection = GetFamilyIndexToCollection(genealogicalDataCommunicationRelations);
foreach (Models.PersonContainer personContainer in personContainers.OrderByDescending(l => l.Key))
@ -441,8 +444,14 @@ internal abstract class PersonContainer
frontMatter = MarkDown.GetFrontMatter(ticks, fullName, lowerHyphenFullName, genealogicalDataCommunication);
if (!frontMatter.Any())
continue;
allFrontMatter.AddRange(frontMatter);
MarkDown.WriteFile(personKeyFormatted, ticks, genealogicalDataCommunicationRelations, a2PeopleContentDirectory, calendar, pattern, personKeyFormattedToPersonFullName, familyIndexToCollection, genealogicalDataCommunication, fullName, lowerHyphenFullName, frontMatter);
}
directory = Path.Combine(a2PeopleContentDirectory, $"{dateTime.Year}-Markdown", $"{dateTime.Year}-Week-{weekOfYear}", ticks.ToString());
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
string text = string.Join(Environment.NewLine, allFrontMatter);
_ = IPath.WriteAllText(Path.Combine(directory, $"{ticks}.md"), text, updateDateWhenMatches: false, compareBeforeWrite: true);
}
}