fix: preserve blank CVs and reliable editor undo
This commit is contained in:
@@ -68,22 +68,25 @@ public static class CvVariantResolver
|
||||
settings = CvVariantSettingsJson.Normalize(settings);
|
||||
var model = new CvRenderModel
|
||||
{
|
||||
FullName = Trim(profile.Contact.FullName) ?? fallbackName,
|
||||
Headline = Trim(settings.Headline) ?? Trim(profile.Contact.Headline),
|
||||
PhotoDataUrl = settings.ShowPhoto ? Trim(photoDataUrl) : null,
|
||||
FullName = settings.IncludeProfileContact == false ? string.Empty : Trim(profile.Contact.FullName) ?? fallbackName,
|
||||
Headline = Trim(settings.Headline) ?? (settings.IncludeProfileContact == false ? null : Trim(profile.Contact.Headline)),
|
||||
PhotoDataUrl = settings.ShowPhoto && settings.IncludeProfileContact != false ? Trim(photoDataUrl) : null,
|
||||
};
|
||||
|
||||
AddContact(model.Contact, "email", profile.Contact.Email, v => $"mailto:{v}");
|
||||
AddContact(model.Contact, "phone", profile.Contact.Phone, v => $"tel:{new string(v.Where(character => char.IsDigit(character) || character == '+').ToArray())}");
|
||||
AddContact(model.Contact, "location", profile.Contact.Location, null);
|
||||
AddContact(model.Contact, "web", profile.Contact.Website, AsUrl);
|
||||
AddContact(model.Contact, "linkedin", profile.Contact.LinkedIn, AsUrl);
|
||||
AddContact(model.Contact, "web", profile.Contact.GitHub, AsUrl);
|
||||
foreach (var link in profile.Contact.Links)
|
||||
if (settings.IncludeProfileContact != false)
|
||||
{
|
||||
var url = Trim(link.Url);
|
||||
if (url is null) continue;
|
||||
model.Contact.Add(new CvContactItem { Icon = "web", Value = Trim(link.Label) ?? url, Href = AsUrl(url) });
|
||||
AddContact(model.Contact, "email", profile.Contact.Email, v => $"mailto:{v}");
|
||||
AddContact(model.Contact, "phone", profile.Contact.Phone, v => $"tel:{new string(v.Where(character => char.IsDigit(character) || character == '+').ToArray())}");
|
||||
AddContact(model.Contact, "location", profile.Contact.Location, null);
|
||||
AddContact(model.Contact, "web", profile.Contact.Website, AsUrl);
|
||||
AddContact(model.Contact, "linkedin", profile.Contact.LinkedIn, AsUrl);
|
||||
AddContact(model.Contact, "web", profile.Contact.GitHub, AsUrl);
|
||||
foreach (var link in profile.Contact.Links)
|
||||
{
|
||||
var url = Trim(link.Url);
|
||||
if (url is null) continue;
|
||||
model.Contact.Add(new CvContactItem { Icon = "web", Value = Trim(link.Label) ?? url, Href = AsUrl(url) });
|
||||
}
|
||||
}
|
||||
|
||||
var built = new Dictionary<string, CvRenderSection>(StringComparer.OrdinalIgnoreCase)
|
||||
@@ -138,10 +141,13 @@ public static class CvVariantResolver
|
||||
settingByKey[section.Key] = section;
|
||||
if (!ordered.Contains(section.Key, StringComparer.OrdinalIgnoreCase)) ordered.Add(section.Key);
|
||||
}
|
||||
if (ordered.Count == 0) ordered.AddRange(DefaultOrder);
|
||||
foreach (var key in built.Keys)
|
||||
if (settings.SectionsExplicit != true)
|
||||
{
|
||||
if (!ordered.Contains(key, StringComparer.OrdinalIgnoreCase)) ordered.Add(key);
|
||||
if (ordered.Count == 0) ordered.AddRange(DefaultOrder);
|
||||
foreach (var key in built.Keys)
|
||||
{
|
||||
if (!ordered.Contains(key, StringComparer.OrdinalIgnoreCase)) ordered.Add(key);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var key in ordered)
|
||||
|
||||
Reference in New Issue
Block a user