feat(cv): qualify templates and reliable local import processing

This commit is contained in:
cesnimda
2026-10-28 14:36:12 +01:00
parent 73ea888375
commit 3f4db8ca81
69 changed files with 2597 additions and 180 deletions
+41
View File
@@ -38,6 +38,8 @@ public sealed class CvTheme
public double PageMarginMm { get; init; } = 16;
public double SectionGapMm { get; init; } = 6;
public double EntryGapMm { get; init; } = 4.5;
public double NameGapMm { get; init; }
public double HeaderContentGapMm { get; init; }
// plain | band | centered | kicker
public string HeaderStyle { get; init; } = "plain";
@@ -159,6 +161,45 @@ public static class CvThemeCatalog
},
};
// Versioned data keeps existing saved lenses and frozen output on their original design.
public static readonly IReadOnlyList<CvTheme> RevisedThemes = Themes.Select(Revised).ToArray();
private static CvTheme Revised(CvTheme source)
{
var (nameSize, sectionGap, entryGap) = source.Id switch
{
"modern" => (25d, 5.8, 4.0),
"minimal" => (25d, 7.5, 4.8),
"executive" => (28d, 6.5, 4.6),
"technical" => (24d, 4.8, 3.2),
"ats-classic" => (23d, 5.0, 3.4),
"nordic" => (23d, 6.0, 4.2),
"elegant" => (27d, 7.5, 5.0),
"creative" => (20d, 5.5, 3.8),
_ => (25.5, 5.2, 3.6),
};
return new CvTheme
{
Id = source.Id, Name = source.Name, Category = source.Category, Description = source.Description,
Layout = source.Layout, SidebarWidthMm = 68,
Accent = source.Accent, Ink = source.Ink, Muted = source.Muted, Line = source.Line,
Paper = source.Paper, SidebarBg = source.SidebarBg, SidebarInk = source.SidebarInk, HeadingColor = source.HeadingColor,
HeadingFont = source.HeadingFont, BodyFont = source.BodyFont, UtilityFont = source.UtilityFont,
NameSizePt = nameSize, HeadingSizePt = source.HeadingSizePt, BodySizePt = source.BodySizePt, LineHeight = source.LineHeight,
PageMarginMm = source.PageMarginMm, SectionGapMm = sectionGap, EntryGapMm = entryGap,
NameGapMm = source.Id is "modern" or "ats-classic" or "code" ? 3 : 0,
HeaderContentGapMm = source.Id is "modern" or "ats-classic" or "code" ? 5 : 0,
HeaderStyle = source.HeaderStyle, HeadingStyle = source.HeadingStyle, PhotoShape = source.PhotoShape,
DefaultIcons = source.DefaultIcons, AtsFriendly = source.AtsFriendly, Premium = source.Premium,
NumberSections = source.NumberSections, DefaultSkillsStyle = source.DefaultSkillsStyle,
SupportedSettings = new(source.SupportedSettings), SidebarSections = new(source.SidebarSections),
};
}
public static CvTheme Resolve(string? id, int? designVersion) => designVersion == 2
? RevisedThemes.FirstOrDefault(theme => theme.Id == (id ?? string.Empty).Trim().ToLowerInvariant()) ?? RevisedThemes[0]
: Resolve(id);
public static CvTheme Resolve(string? id)
{
var key = (id ?? string.Empty).Trim().ToLowerInvariant();