From 151ea12251ed876aa87bb486da1bc337e25369e9 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sat, 1 Aug 2026 16:18:19 -0300 Subject: --- vrsite/static.go | 50 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-) (limited to 'vrsite/static.go') diff --git a/vrsite/static.go b/vrsite/static.go index 7d31b1d..b299975 100644 --- a/vrsite/static.go +++ b/vrsite/static.go @@ -13,6 +13,7 @@ import ( "os/exec" "path/filepath" "runtime" + "strconv" "strings" "sync" "time" @@ -31,7 +32,7 @@ func run(dir string, name string, args ...string) []byte { return out } -func buildSite(logPath, repoAbs, out, title string, theme, light *Theme) { +func buildSite(logPath, repoAbs, out, title string, theme, light *Theme, themes *themeSet) { start := time.Now() entries := readLog(logPath) ranked := buildModel(title, entries, "").Ranked @@ -80,7 +81,7 @@ func buildSite(logPath, repoAbs, out, title string, theme, light *Theme) { fatal("tar: %v", err) } - writeSite(site, out, tmp) + writeSite(site, out, tmp, themes) stubs := 0 for _, f := range site.All { if f.Stub != "" { @@ -92,8 +93,12 @@ func buildSite(logPath, repoAbs, out, title string, theme, light *Theme) { time.Since(start).Round(time.Millisecond), out) } -func writeSite(site *Site, out, srcDir string) { - tpl := newTemplates() +func writeSite(site *Site, out, srcDir string, themes *themeSet) { + if themes == nil { + themes = &themeSet{} + } + hl := newHighlighter(site.Theme, site.Light) + tpl := newTemplates(hl) if err := os.MkdirAll(out, 0o755); err != nil { fatal("%v", err) } @@ -113,7 +118,6 @@ func writeSite(site *Site, out, srcDir string) { } // phase A: content — coverage percentages must exist before any tree // or index below is written - hl := newHighlighter(site.Theme, site.Light) each(func(f *File) { src, err := os.ReadFile(filepath.Join(srcDir, f.Path)) switch { @@ -142,6 +146,13 @@ func writeSite(site *Site, out, srcDir string) { fatal("%v", err) } } + // the picker travels with the export: a