feat(cv): extend templates and extraction
This commit is contained in:
@@ -25,13 +25,20 @@ public sealed class CvRenderSection
|
||||
{
|
||||
public string Key { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
// bullets | tags | entries
|
||||
// bullets | tags | paragraphs | skill-groups | entries
|
||||
public string Kind { get; set; } = "entries";
|
||||
public List<string> Bullets { get; set; } = new();
|
||||
public List<string> Tags { get; set; } = new();
|
||||
public List<CvRenderEntry> Entries { get; set; } = new();
|
||||
public List<CvRenderSkillGroup> SkillGroups { get; set; } = new();
|
||||
|
||||
public bool IsEmpty => Bullets.Count == 0 && Tags.Count == 0 && Entries.Count == 0;
|
||||
public bool IsEmpty => Bullets.Count == 0 && Tags.Count == 0 && Entries.Count == 0 && SkillGroups.Count == 0;
|
||||
}
|
||||
|
||||
public sealed class CvRenderSkillGroup
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public List<string> Items { get; set; } = new();
|
||||
}
|
||||
|
||||
public sealed class CvRenderEntry
|
||||
@@ -114,7 +121,7 @@ public static class CvVariantResolver
|
||||
{
|
||||
Key = key,
|
||||
Title = Trim(custom.Title) ?? "Additional",
|
||||
Kind = "bullets",
|
||||
Kind = custom.ContentType == "paragraphs" ? "paragraphs" : "bullets",
|
||||
Bullets = Clean(custom.Items),
|
||||
};
|
||||
}
|
||||
@@ -142,6 +149,11 @@ public static class CvVariantResolver
|
||||
{
|
||||
if (cfg.Hidden) continue;
|
||||
if (!string.IsNullOrWhiteSpace(cfg.Title)) section.Title = cfg.Title!.Trim();
|
||||
if (cfg.Items is not null && section.Kind is "bullets" or "tags")
|
||||
{
|
||||
if (section.Kind == "tags") section.Tags = Clean(cfg.Items);
|
||||
else section.Bullets = Clean(cfg.Items);
|
||||
}
|
||||
if (cfg.ItemOrder is { Count: > 0 } && section.Entries.Count > 1)
|
||||
{
|
||||
section.Entries = ReorderByKey(section.Entries, cfg.ItemOrder);
|
||||
@@ -154,6 +166,20 @@ public static class CvVariantResolver
|
||||
if (!section.IsEmpty) model.Sections.Add(section);
|
||||
}
|
||||
|
||||
if (settings.SkillGroups is { Count: > 0 })
|
||||
{
|
||||
var skills = model.Sections.FirstOrDefault(section => section.Key.Equals("skills", StringComparison.OrdinalIgnoreCase));
|
||||
if (skills is not null)
|
||||
{
|
||||
skills.Kind = "skill-groups";
|
||||
skills.Tags.Clear();
|
||||
skills.SkillGroups = settings.SkillGroups
|
||||
.Select(group => new CvRenderSkillGroup { Name = Trim(group.Name) ?? string.Empty, Items = Clean(group.Items) })
|
||||
.Where(group => group.Items.Count > 0)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user